RegisterOfficeAddin
Command-line Parameters
/app | Required without the /file parameter. |
<appname> | Required with /app. Currently, only “EXCEL” is supported. |
/commandpath | Required without the /file parameter. |
<path> | Required with /commandpath. This is the full path to your add-in file. |
/version | Optional. This is used to identify the version being targetted. |
<versionvalue> | Required for /version. Must be one of: 11, 12, 14, 15, 16, ALL. The default value is ALL. |
/remove | Optional. This will direct the installer to remove the registry keys that match the configuration file or /app, /commandpath, and /version parameters. |
/file | Required without the /app and /commandpath parameters. This is used to indicate an xml configuration file is to be used. |
<filename> | Required with /file. This is the full path to the XML configuration file to be used. |
Command-line Example
registerofficeaddin /app excel /commandpath "c:/program files (x86)/my app folder/myaddin.xll"
Example XML for a WIX Setup Project
The XML snippets below illustrate how to include into a WIX Installer project. You can get your add-in registered with Excel by adding a CustomAction element. You should add two CustomAction elements. One is for the install and one for the uninstall.
<CustomAction
Id="RegisterAddIn"
FileKey="File_RegisterOfficeAddIn.exe"
ExeCommand="/app excel /commandpath "c:/program files (x86)/your_app_folder/your_addin.xll""
Return="check"
Execute="deferred" />
<CustomAction
Id="UnRegisterAddIn"
FileKey="File_RegisterOfficeAddIn.exe"
ExeCommand="/app excel /commandpath "c:/program files (x86)/your_app_folder/your_addin.xll" /remove"
Return="check"
Execute="deferred" />
Note the use of the escaped quotation character (“"“) within the ExeCommand string. This is needed to handle spaces in the file path.
After the CustomAction elements, add them in the InstallExecuteSequence section.
<InstallExecuteSequence>
<Custom Action="RegisterAddIn" After="InstallFiles">NOT Installed</Custom>
<Custom Action="UnRegisterAddIn" Before="RemoveFiles">Installed</Custom>
</InstallExecuteSequence>
Of course you will need to ensure you have included RegisterOfficeAddin.EXE in the files you are installing to the target system. An example is below.
<Fragment>
<ComponentGroup
Id="ProductComponents"
Directory="INSTALLFOLDER">
<Component
Id="File_RegisterOfficeAddIn.exe"
Guid="your_guid_here">
<File
Id="File_RegisterOfficeAddIn.exe"
Name="RegisterOfficeAddIn.exe"
Source="c:pathtowhereyouputregisterofficeaddin.exe" />
</Component>
</ComponentGroup>
</Fragment>
XML Config File
You can optionally set up an XML configuration file. The structure of the file is illustrated below.
<?xml version="1.0" encoding="utf-8"?>
<addinconfig>
<app>excel</app>
<commandpath>c:/program files (x86)/your addin folder/youraddin.xll</commandpath>
<version>all</version>
</addinconfig>
System Requirements
Requires .Net Framework version 4 on target systems.