Using Registry to install Excel AddIn

11.2k views Asked by At

I created an excel Add-In called

Project Count_Per Person.xlam

When I open up excel and go to Development>AddIns and select my AddIn to install, it does not stay installed if I close out of excel even after saving. The AddIn I made, creates a new MenuBarButton under the tab 'AddIns'

So I created a new registry Key to install the addin at startup under

HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\ProjectCount_PerPerson

The Key looks like this

(Default)     REG_SZ        (value not set)
Description   REG_SZ        Project Count_Per Person
FriendlyName  REG_SZ        Project Count_Per Person
LoadBehavior  DWORD         0x00000003 (3)
Manifest      REG_SZ        C:\Users\b012918\AppData\Roaming\Microsoft\AddIns\Project Count_Per Person.xlam

When I start Excel, it displays that it is installing the AddIn, but then I get an

Exception reading manifest from

file:///C:/Users/b012918/AppData/Roaming/Microsoft/AddIns/Project%Count_Per%Person.xlam:

the manifest may not be valid or file could not be opened.

http://pastebin.com/bN1datV5

Any insight into what I'm messing up would be beneficial.

Additional Information:

If the addin is uninstalled when I start excel, it gives the manifest error. If the addin is 'checked' when I start excel, it gives the download error in the comment below. Even if the addin is previously installed, the CommandBarButton does not stay in place. Also, under options--> addins the addin is stated to be "Active".

2

There are 2 answers

0
brett s On BEST ANSWER

I Built an Add-In called 'FirstExcelAddIn' with Visual Studio, and checked to see what it did when It built the Registry Keys. I had my registry correct from the keys shown in the question, I just did not have all the files it was looking for in a COM addin.

Here is what my functioning addin looks like in the registry

(Default)     REG_SZ        (value not set)
Description   REG_SZ        FirstExcelAddIn
FriendlyName  REG_SZ        FirstExcelAddIn
LoadBehavior  DWORD         0x00000003 (3)
Manifest      REG_SZ        C:\Users\b012918\AppData\Roaming\Microsoft\AddIns\FirstExcelAddIn.vsto|vstolocal

Here are the files that need to be present in the folder for the addin to work properly

  1. FirstExcelAddIn.dll
  2. FirstExcelAddIn.dll.manifest
  3. FirstExcelAddIn.vsto
  4. Microsoft.Office.Tools.Common.v4.0.Utilities.dll

I suspect that if you went through the effort to write your Add-In from scratch without tools, you would only need the '.dll' and '.dll.manifest' for your addin to work.

1
SeriousITGuy On

Just to clarify, there are two types of addins for Excel (and the other Office apps), VBA addins and COM addins. A COM addin is developed via Visual Studio and the Visual Studio Tools for Office. That is what brett s is referencing to.

But the more likely type are normal VBA Excel Addins, typically distributed via a .xlam file. In order to load such an addin automatically for a user, you need the addin file on some local directory on the machine and reference it via the Registry. For Excel 2010, a REG file to load the corresponding registry key is:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Excel\Options]
"OPEN"="C:\\Path\\To\Addin\\Addin.xlam"

This way the addin is loaded everytime you start Excel.