Link to home
Start Free TrialLog in
Avatar of Paul Barrett
Paul BarrettFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access 2007 Enable All Macros using vba module

I am distributing an Access front-end 2007 db to 25 user profiles on a terminal server.  This is done on a log-in script whereby the db is placed in a folder C:\Users\UserName\etc.  So Username in folder string is always different.

I need to be able to automate setting macro securtiy to 'enable all macros' in a code module.
Can this be done or if not does someone have a way of setting a registry key through a code module that will do the same job for that user?

Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security]
"VBAWarnings"=dword:00000001

Will enable all macro's without warnings for current user.
I take it that each user have to log into the network using there username. It so all you have to do it set the access based on the username of the person logged in. You can accesss the network user name by the following code

Environ("username")

This also means that you don't have to set login in the database you just piggy back on the network login.
I have almost 1000 Terminal Server users I support running Access apps..

Since this must be down by user, I use a log on script for all users that set the macro security level to low.

I use VBS to add the reg key.

If you would like, I can post the files.
Fully knocking down macro security might be overkill.
How about adding the location to the trust center.
If you go one layer higher than the user's name, you won't even need to know the username

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations\Location0]
"Path"="C:\Users\UserName\etc"
"AllowSubfolders"=dword:00000001
"Description"=""
"Date"="9/2/2010 6:10 PM"
Avatar of Paul Barrett

ASKER

Hi gersinjansen as you were the first to respond I'm, running with yours at the moment.  Can the registry key be set using vba module within my Access 2007 app?
ASKER CERTIFIED SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
See the problem, until off would get warnings on startup of app, thanks I have enough to sort out this solution now.