How to install an Excel Add-in (XLA or XLL) with Automation
This article was previously published under Q280290
This article has been archived. It is offered "as is" and will no longer be updated.
This article illustrates how to install an Excel Add-in (xla or xll) with Automation.
The following code demonstrates how to use Automation to:
- 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 ObjectSet oXL = CreateObject("Excel.Application")oXL.Workbooks.AddSet oAddin = oXL.AddIns.Add("C:\test.xla", True)oAddin.Installed = TrueoXL.QuitSet 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.
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
161439 XL97: How to Remove Entries from Add-Ins Dialog Box
211956 XL2000: Cannot Delete Entries from Add-Ins Dialog Box
1004 runtime run-time error kbofficeprog addin
Article ID: 280290 - Last Review: 12/05/2015 22:54:43 - Revision: 5.2
Microsoft Office Excel 2003, Microsoft Excel 2002 Standard Edition, Microsoft Excel 2000 Standard Edition, Microsoft Excel 97 Standard Edition, Microsoft Visual Basic 6.0 Professional Edition, Microsoft Visual Basic Enterprise Edition for Windows 6.0
- kbnosurvey kbarchive kbautomation kbhowto kbprogramming KB280290