Change Access 2003 macro security from VBA

K

Kevin

Just upgraded to 2003 and immediately got hit by the macro security
deal. Found some code that purports to fix this programmatically:


Sub Security()
' Dim secAutomation As MsoAutomationSecurity
' secAutomation = Application.AutomationSecurity
' Application.AutomationSecurity = msoAutomationSecurityForceDisable
' With Application.FileDialog(msoFileDialogOpen)
' .Show
' .Execute
' End With
' Application.AutomationSecurity = secAutomation
End Sub

but a compile stops on MsoAutomationSecurity, and I can't find where to
create a reference to it. Searches on MSKB and Google haven't helped.
Where is this puppy? I really don't want want to go to each users
machine and go through the multi-step process to turn security low, or
stop programmatically changing queries.

Kevin
 
A

Albert D. Kallal

I am not sure if you can change those settings from VBA.

You can certainly copy the security menu and create your own custom menu
bar. I tested this, and it works.

You can also simply add the following two keys to the package install (if
using runtime), and all nags
messages will disappear:

ROOT:Local Machine
Key: SOFTWARE\Microsoft\Jet\4.0\Engines
Name:SandBoxMode
Value:#00000002

ROOT:Local Machine
Key: Software\Microsoft\Office\11.0\Access\Security
Name:Level
Value:#00000001

The first setting sets JET to sandbox mode for non ms-access applications.
The 2nd setting sets the macro security to low. It is also possible to
incorporate the security setting menu into your application if you want to
make
the security setting a user option (I tested this, and simply building a
menu bar and stealing (copy) the security menu into a custom menu bar works
fine both in the runtime and regular version.).

So, it is VERY easy to get rid of the security prompts, or VERY easy to
supply the end users with a menu option in the application. From VBA,
hum..not sure

Note that if you are going to edit the registry, then use dword values of 2
and 1 in place of the above # with leading zeros. (that above format is only
for the msi installer..and not regedit).
 
D

Douglas J. Steele

While Albert's given you a solution, the answer to your specific question is
that MsoAutomationSecurity is from the Microsoft.Office 11.0 Object Libary.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top