English

How To: Lock VBA customizations to ArcMap and ArcCatalog

Summary

The method described in this document restricts access to the normal.mxt and normal.gxt files that contain customizations for ArcMap and ArcCatalog. These files are created from scratch in a user's Winnt\Profiles\<username>\Application Data\ESRI folder.

There is no way to control the contents of the Normal.* files, if they are not preexisting. However; however, if the files exist, their permissions can be modified to prevent other users from changing customizations.

Procedure

  1. Log in as the system administrator, and start ArcMap and ArcCatalog. This will create the following files:

    Code:
    c:\Winnt\Profiles\<username>\Application Data\ESRI\ArcMap\templates\Normal.mxt


    Code:
    :\Winnt\Profiles\<username>\Application Data\ESRI\ArcCatalog\Normal.gxt


    where <username> is the name of the administrator.

  2. Open ArcMap's Visual Basic Editor.

    In ArcMap, select Tools > Macros > Visual Basic Editor.



  3. In the VBA project explorer window, expand Normal.mxt to expose ThisDocument and open its code window.
  4. Select MxDocument from the Object dropdown list, and NewDocument from the Procedure dropdown list in the code window.
    [O-Image] Select New Document from This Document Code Window
  5. Add this code to the NewDocument procedure:
    Code:
    LockCustomization "<password>"


    where <password> is the desired password needed to make interface customizations.

  6. Add the same code to an OpenDocument procedure, which is also found in the Procedures dropdown list.

  7. Save Normal.mxt while in VBA, exit VBA, and exit ArcMap.

  8. Open ArcCatalog's Visual Basic Editor.

    In ArcCatalog, select Tools > Macros > Visual Basic Editor.



  9. In the project explorer window, expand Normal.gxt to expose ThisDocument and open its code window.

  10. At the top of the code window, select GxDocument from the Object dropdown list and OpenDocument from the procedure dropdown list.

  11. Add the same code to the GxDocument_OpenDocument procedure as in Step 5.

  12. Save the changes in VBA, exit VBA, and exit ArcCatalog.

  13. In Windows Explorer (the file browser), navigate to the administrative login account's:
    Code:
    c:\Winnt\Profiles\<username>\Application Data\ESRI\ArcMap\templates\Normal.mxt


    Set the permissions for Everyone to Read Only.

  14. Navigate to the administrative login account's:
    Code:
    c:\Winnt\Profiles\<username>\Application Data\ESRI\ArcCatalog\Normal.gxt


    Set the permissions for Everyone to Read Only.

  15. As the administrative account, copy the Normal.mxt and Normal.gxt to each user's directories:
    Code:
    c:\Winnt\Profiles\<username>\Application Data\ESRI\ArcMap\templates


    Code:
    c:\Winnt\Profiles\<username>\Application Data\ESRI\ArcCatalog


  16. After copying these files, be sure the ownership still indicates the administrator as owner and everyone else has only read access to these files.

    Note:
    Anyone with administrative privileges will be able to delete these modified files. If they do, then the next time they start ArcMap or ArcCatalog, new versions of these files will be created and they won't lock customization.
    It may be necessary to have one account that owns and has full control of these files, that way, other administrators will not have access to the files.


    Note:
    This methodology has not been tested or certified by the normal ESRI development procedures, so there may be unknown problems as a result of limiting permissions on these files. Users who choose to implement this locking methodology should experiment with it in a test environment before trying to implement it in any production environment.