Enable all macros with VBA

ppataki

Registered User.
Local time
Today, 09:54
Joined
Sep 5, 2008
Messages
267
Dear All,

In Trust Center settings there is an option group where user can enable/disable macros (there are like 4 options)

My question would be: how can I toggle these options through VBA? (so without going to Trust Center and enabling them manually)

Many thanks in advance
 
How will the code you want to create be able to run to alter the user's trust center settings if macros and code are disabled because of the user's trust settings for their computer? ;)
 
To go with ghudson's answer -

a simple - YOU CAN'T. That is the point of that selection - to keep macros or code from running.
 
Hi everyone

The macro options are changed by the Windows registry

HKEY_CURRENT_USER \ Software \ Microsoft \ Office \ 12.0 \ Access \ Security \ VBAWarnings

Manually change the options of the macro is back to the Windows registry to see the value of VBAWarnings

Now just use a script to change the value of this key

Learn also about CurrentProject.IsTrusted (see google or here in the forum)

Success
 
it works, but first you need to check the version number in the registry, I think for Access 2010 it will be 13.0 instead of 12.0
 
Access 2010 is version 14.

For some reason they skipped Access 13.
 
Perhaps the developers where Triskaidekaphobic?
Nope, but they were mindful that some of their customers might be and so they did it that way (info straight from the developers themselves when I was at the Access Dev Kitchen back when they were still quite a ways from release).
:)
 
Nope, but they were mindful that some of their customers might be and so they did it that way (info straight from the developers themselves when I was at the Access Dev Kitchen back when they were still quite a ways from release).
:)
Thanks for the considered response to what was nothing more than a facile remark :o
 
I see VBAWarning is equal to 1. What value should I see to enable all macros?
 
Thanks much. I have 2010. I have determined that I don't have enable issue with anything. Some buttons just do nothing when clicked.
Works on other computers, so I know Access is good.
Any ideas?
 
When I try to add trusted location, error message: "The remote or network path you have entered is not allowed by your current security settings".
???
 
When I try to add trusted location, error message: "The remote or network path you have entered is not allowed by your current security settings".
???

You can't do that with VBA. You would need to run a batch file to add that. But again, the thing to remember is that there are reasons why this is so difficult to automate. Microsoft has tried to make it extremely difficult for nasty malware to do anything in Windows without you letting it happen. So, just imagine, for a moment, what would happen if you can just change the security settings by some code without user intervention? Just because you aren't trying to install malware doesn't mean that someone else couldn't just use the door you would use. So, again, you really need to have the security settings changed MANUALLY (it can be having a .reg file which the user activates, or batch file which does the adding of it and it needs to run with elevated permissions on Vista and Windows 7).
 

Users who are viewing this thread

Back
Top Bottom