Link to home
Start Free TrialLog in
Avatar of twarrenb
twarrenbFlag for United States of America

asked on

VBA code to add trusted location in Microsoft Access 2010

Does someone have VBA code that will add a trusted location in Microsoft Access 2010?
Avatar of Shahid Thaika
Shahid Thaika
Flag of India image

Unfortunately, you cannot do that by code, and that's the answer. Think of it this was, Excel does not trust VBA coding, and you are trying to have it trust through VBA coding... will not work. You have to manually Trust VBA using Excel options.
Avatar of twarrenb

ASKER

The question was poorly worded.  What I'm looking for is VB code that can be run in Microsoft Access 2010 that will designate a specified folder as being a trusted location.
I am not sure if Access VBA has in-built commands to add trusted location, but you could try adding it by making appropriate registry entries. If you don't know how to edit the registry using VB, there are many tutorials out there.

All trusted locations are stored in the registry at:
HKEY_CURRENT_USER/Software/Microsoft/Office/14.0/application_name/Security/Trusted Locations

Where "application_name" can be Microsoft Access, Microsoft Excel, etc. Trusted locations are stored in registry entries named Path as String (REG_SZ) value types. With a little bit of discovery, you should be able to add trusted locations through your app.


See the following article for more info...
http://technet.microsoft.com/en-us/library/cc179039(office.14).aspx
I know that Access VBA has no built-in command and that trusted locations are stored as you describe.  However, I was looking for code that would add trusted locations to the registry.  Thanks for your help/
ASKER CERTIFIED SOLUTION
Avatar of Shahid Thaika
Shahid Thaika
Flag of India 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
While the expert didn't cite actual code, he or she directed me to tutorials where I can teach myself.