- Add a new workbook.
- Call the Add method of the AddIns collection to add the new add-in to the list of add-ins in Excel Add-In Manager.
- Set the Install property of the AddIn object to True (equivalent to selecting the add-in the Add-in Manager).Note that a workbook is added prior to calling the Add method in this example. The Add-in Manager in Excel is not available unless there is at least one visible workbook open. Without this line of code, you receive one of the following error messages:
Dim oXL As Object, oAddin As Object
Set oXL = CreateObject("Excel.Application")
Set oAddin = oXL.AddIns.Add("C:\test.xla", True)
oAddin.Installed = True
Set oXL = NothingRun-time error '1004':
Unable to get the Add property of the AddIns class-or-Run-time error '1004':
Add method of addins class failed.
Article ID: 280290 - Last Review: Mar 23, 2009 - Revision: 1