Access 2007 Enable All Macros using vba module

Posted on 2011-05-05
Last Modified: 2012-05-11
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?

Question by:Paul-bbc
    LVL 37

    Expert Comment

    by:Gerwin Jansen
    Windows Registry Editor Version 5.00


    Will enable all macro's without warnings for current user.
    LVL 16

    Expert Comment

    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


    This also means that you don't have to set login in the database you just piggy back on the network login.
    LVL 21
    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.
    LVL 26

    Expert Comment

    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]
    "Date"="9/2/2010 6:10 PM"

    Author Comment

    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?
    LVL 37

    Accepted Solution

    Yes, this is possible but then you would have to start the Access app first (chicken/egg problem).  The setting is meant to be applied before you start Access, thus preventing macro warnings/popups. I'm using reg settings from a batch file that first calls "regedit /S <regfile>" after which I start the Access app.

    Author Comment

    See the problem, until off would get warnings on startup of app, thanks I have enough to sort out this solution now.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now