Access.2007.VBA.Bibl..

(John Hannent) #1

Menu Add-ins ........................................................................................................


A menu add-in needs three rows in the USysRegInfo table, each with an appropriate value in the
Type field, and some with values in the ValName or Value field as well, as described in detail next:

n In the first row of the add-in, the Subkey field (which is the same for all the add-in’s
rows) has the Registry key information, referencing the Menu Add-Ins section under the
HKEY_CURRENT_ACCESS_PROFILE key (which references the currently running ver-
sion of Access), and ending with the command name to display on the Add-Ins menu,
with an ampersand if desired to make a hot key. The Type field has a value of 0, indicat-
ing the start of a new add-in. The ValName and Value fields are blank.
n In the second row of the add-in, the Type field has a value of 1, the ValName field has the
value “Library,” and the Value field has the location and name of the library database,
using the |ACCDIR\ placeholder to point to the AddIns folder (in earlier versions of
Access, this was the Access folder itself, which explains the name).
n In the add-in’s third row, the Type field has a value of 1, the ValName field has the value
“Expression,” and the Value field has the name of function to run (preceded by an equals
sign, and followed by a pair of parentheses).

In Table 14.3, which lists the three rows for the “Back up Database” command on the AddIns
menu, the italicized text is the information specific to this add-in; the other information is com-
mon to all menu add-ins.

When creating a UsysRegInfo table for an Access 2007 add-in that is to be run in
Windows Vista, you need to change the capitalization of “Menu Add-ins” to Menu Add-
Ins” (capitalizing the I); if you leave it lowercased as for previous versions of Office and Windows,
you will not be able to install the add-in.

TABLE 14.3

USysRegInfo Rows Needed for a Menu Add-in


Subkey Type ValName Value

HKEY_CURRENT_ACCESS_PROFILE\Menu Add-Ins\ 0
&Back up Database
HKEY_CURRENT_ACCESS_PROFILE\Menu Add-Ins\ 1 Library |ACCDIR\Extras 2007.accda
&Back up Database
HKEY_CURRENT_ACCESS_PROFILE\Menu Add-Ins\ 1 Expression =BackupFrontEnd()
&Back up Database

If you make copies of your add-in library database from time to time while working on it
(always a good idea), don’t save the copies in the AddIns folder, because otherwise they
will show up as extra selections in the Add-In Manager dialog, and it may not be clear which is the lat-
est version of the add-in when installing it, or which version is running when you use the add-in.

TIPTIP


TIPTIP


Part III Adding More Functionality to Office

Free download pdf