Supporting the Add-In Manager

There are some additional steps you can take to work with the Microsoft Excel Add-In Manager.

This function

Is called when the Add-In Manager

xlAutoAdd()

Adds an XLL

xlAutoRemove()

Removes an XLL

xlAddInManagerInfo()

Needs additional information from the XLL


Adding New XLLs with the Add-In Manager

The following steps describe how to use the Add-In Manager to add new XLLs.

1. The user chooses the Add-Ins... command from the Tools menu and selects the check box next to the name of the add-in or chooses the Browse button if the add-in is in a different directory.

a. If the user chooses the Browse button, the Add-In Manager displays the Browse dialog box, allowing the user to select XLA files or XLL files.

b. The user chooses a file. If it is an XLL file, the Add-In Manager attempts to register and run the xlAutoAdd function in the XLL. This function takes no arguments. Your XLL can optionally display a message telling the user that the XLL is now available and how to get it.

2. The Add-In Manager calls REGISTER() on the XLL, which causes the XLL's xlAutoOpen function to run.

3. The Add-In Manager attempts to register and run a function called xlAutoAdd in the XLL. This function takes no arguments. It can do anything you want it to do before your add-in is added by the Add-In Manager.

4. The Add-In Manager also adds an OPEN= line to the "Microsoft Excel" key in the registry. This causes Microsoft Excel to automatically open your XLL whenever Microsoft Excel is started.

5. The Add-In Manager tries to register and call the xlAddInManagerInfo function in your XLL to find out more information about the XLL. For more information, see the section "Supporting the Add-In Manager's Long Names" on page 190.

Removing XLLs with the Add-In Manager

The following steps describe how to use the Add-In Manager to remove installed XLLs.

1. The user runs the Add-Ins... command from the Tools menu and deselects the check box for the XLL.

2. The Add-In Manager attempts to register and run a function called xlAutoRemove in the XLL. This function takes no arguments. It can do anything you want it to do before your add-in is removed with the Add-In Manager.

3. The Add-In Manager calls UNREGISTER on the XLL, which causes the XLL's xlAutoClose function to run and unregisters all the functions in the XLL, removing it from memory.

4. The Add-In Manager also removes the OPEN= line from the "Microsoft Excel" key in the registry.

Supporting the Add-In Manager's Long Names

The Add-In Manager can optionally display a longer, more descriptive name for your XLL, in addition to the file name. When running with MS-DOS, this is preferable to seeing only the eight-character file name. To support this, the Add-In Manager attempts to register and call a function in your XLL named xlAddInManagerInfo. This function is of type "PP", which takes a value LPXLOPER and returns a value LPXLOPER. When the Add-In Manager needs a long file name, it calls this function with 1 as the argument. Your xlAddInManagerInfo function should check this argument. If it is 1, the function should return an xltypeStr containing the long name of the XLL add-in. If the argument is not 1, the function should return #VALUE! as an xlypeErr.