Any help would be appreciated...I am using Excel 2007.
My objective is to load an add-in file when you run Excel as an OLE Automation object, without having to load the add-in manually. However, the macro is not loading solver automatically:
Source for code: http://support.microsoft.com/kb/213489/
My objective is to load an add-in file when you run Excel as an OLE Automation object, without having to load the add-in manually. However, the macro is not loading solver automatically:
Code:
Sub LoadAddIn()
Dim xl As Object
' Activate Microsoft Excel and assign to variable xl.
Set xl = CreateObject("Excel.Application")
' Open the add-in file you want, in this example, Solver.XLAM.
xl.Workbooks.Open ("C:\Program Files\Microsoft Office\Office12\Library\SOLVER\solver.XLAM")
' If you need to register the functions and commands
' contained in a resource (XLL), use the RegisterXLL method.
' In the example below, all functions of Analys32.xll are
' registered.
' XL.RegisterXLL "Analys32.xll"
' Run any auto macros contained in the add-in file
' Auto macros don't run when you open a file
' using the Open method.
xl.Workbooks("Solver.xlam").RunAutoMacros 1
Set xl = Nothing
End Sub
Source for code: http://support.microsoft.com/kb/213489/