Add Solver in VB:
Please note that it is important to set a correct reference.before Solver is
loaded.
An Add-Inn that does get loaded becomes "active." Without a correction,
"ActiveWorkbook.whatever..." would point to the Add-Inn itself. (an error)
Sub SolverLoad()
'// Adds Solver
Dim wb As Workbook
On Error Resume Next
'// *** Set to the correct workbook!
Set wb = ActiveWorkbook
If Not AddIns("Solver Add-In").Installed Then AddIns("Solver
Add-In").Installed = True
wb.Activate
wb.VBProject.References.AddFromFile Application.LibraryPath &
"\SOLVER\SOLVER.XLAM"
End Sub
Bookmarks