How do I enable an Excel Automation Add-in through the registry?

Frank picture Frank · Jun 10, 2011 · Viewed 14.8k times · Source

I have an Excel Automation Add-in that is registered with COM by my installer. By registering with COM, my add-in appears in the (for Excel 2007) Excel Options > Add-Ins > Manage Excel Add-Ins Go... > Automation list. The users must still navigate to the dialog above and select my add-in to enable it.

Is it possible (via a registry key perhaps) to enable my automaton add-in programmatically in my installer class (or in VBA) after the types are registered with COM?

Thanks in advance - Frank

Answer

Hari Seldon picture Hari Seldon · Jun 12, 2011

Ive not done ths specifically, but a reference that I use has this to say regarding your question:

Automation Add-Ins are loaded in the same way as normal .xla Add-Ins , but using the ProgID instead of the file name, as in the following code:

Sub installAutomationAddIn()
    AddIns.Add Filename:="Excel2007ProgRef.Simple"
    AddIns("Excel2007ProgRef.Simple").Installed = True
End Sub

If you are creating an installation routinefor your Add-In, you may want to write directly to the registry in order to set the Automation Add-In as installed. To do so, you need to create the following registry entry (Which will already exist if you've used the above code).

(In the Registry Key:)
HKEY_CURRENT_USER\SOftware\Microsoft\Office\12.0\Excel\Options

(Create the string value:)
Name = the first unused item in the series: Open, Open1, Open2, etc.
Value = /A "Excel2007ProgRef.Simple"