Menu Addins

A menu add-in needs three rows in the USysReglnfo 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:

■ 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 version 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, indicating the start of a new add-in. The ValName and Value fields are blank.

■ 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).

■ 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 common to all menu add-ins.

When creating a UsysReglnfo 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 AddIns" (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\ &Back up Database

0

HKEY_CURRENT_ACCESS_PROFILE\Menu Add-Ins\ &Back up Database

1

Library |ACCDIR\£xiras 2007.accda

HKEY_CURRENT_ACCESS_PROFILE\Menu Add-Ins\ &Back up Database

1

Expression =BackupFrontEnd()

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 latest version of the add-in when installing it, or which version is running when you use the add-in.

0 0

Post a comment