Once prepared, we want to deploy our Excel Add-Ins to users. Typically, an Add-In Manager is used to install Microsoft Office Add-Ins. There’s nothing but some Registry entries we can write ourselves. A simple Delphi console application can be used to do this and deployment can be done with a batch file which runs from login script, for example.
Excel stores information about installed add-ins in the following registry location.
This is applicable for normal VBA add-ins (xla, xlam), Native add-ins (xll) and Automation add-ins. The
<Version> part of the registry path is the numeric Excel version, e.g. 10.0 for Excel XP or 14.0 for Excel 2010.
If you remove an add-in it is still displayed in the Add-In Manager but the checkbox is unchecked. Information about the displayed add-ins is stored in the following location.
To be more precise, it may be the location for displayed add-ins because Excel does not store anything if the add-in is located on a default file location (library path).
The displayed add-ins are stored as string values (
REG_SZ). The value names are equal to the add-in names with full path.
Installed add-ins are also stored as string values. The value names are numbered
"OPEN2" and so on. These values contain the add-in’s name enclosed in quotes (with full path where necessary). The values are prefixed with a “
/R” parameter for XLL files and with a “
/A” parameter for Automation add-ins. The Automation add-in’s name is its ProgID.
That’s the information we need to write an Install application for Excel add-ins. The thing we need to keep in mind is the fact that Excel cannot have to files open with the same name. So, if we want to add and add-in, we need to check if there is already an add-in installed with the same name. In that case we should overwrite the existing registry entry.
Excel rewrites add-in information on close. An Install application should check whether Excel is running or not to prevent changes from being overwritten by Excel. And last but not least, the Install application should not allow multiple instances because of a possible renumbering of the
OPENx entries on remove of add-ins.
I have added my Delphi installer for Excel Add-Ins to the download section. It is a console application which does the things described above. You can use it with a batch as mentioned at the beginning in the following way.
REM assumed that batch, installer and add-in have the same location mkdir "%APPDATA%\Microsoft\AddIns" 2>nul copy /Y "%~dp0MyAddIn.xla" "%APPDATA%\Microsoft\AddIns" >nul "%~dp0AddInInst.exe" /Q "%APPDATA%\Microsoft\AddIns\MyAddIn.xla"
The Delphi source code is included that you can see how it works. It is provided “as is”. If you think it’s useful you are invited to make a donation.