How to determine if SOLVER Add In is installed
How to determine if SOLVER Add In is installed
(OP)
My application is using Excel SOLVER and I have a reference to it in VBA. When program is run on the computer without SOLVER installed as a part of Office, the message: library is not found will appear. Debbuging with 'On Error' does not work since the error is found during compilation.
If anybody knows how to determine if SOLVER is installed beforehand? Thank you for the reponses!
Yakov
If anybody knows how to determine if SOLVER is installed beforehand? Thank you for the reponses!
Yakov





RE: How to determine if SOLVER Add In is installed
I'm not sure about a more graceful solution, but I'll give it some pondering.
RE: How to determine if SOLVER Add In is installed
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q291295
this talks about explicitly using solver.xla as a reference in XL2000, so I suppose that whether or not it is present may serve as a useful check.
here's another MS help doc that might be useful:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q116340
' Macro to call Solver main dialog box.
Sub MainSolverDialog()
' Turn error checking off.
On Error Resume Next
' Test if Solver add-in is already open.
If Application.IsNA(Workbooks("Solver.xla").Name) Then
' If add-in is not open, then open Solver.xla.
' NOTE: You may need to adjust the path to Solver.xla.
' For example, the path may be
' C:\MSOffice\Excel\Library\Solver\Solver.xla.
Workbooks.Open ("C:\Excel\Library\Solver\Solver.xla")
' Run Solver auto open macro to load add-in.
Application.Run ("Solver.xla!Auto_Open")
' Ends the If statement.
End If
' Turn error checking back on.
On Error GoTo 0
' Run the Solver macro to display the main Solver dialog box.
Application.Run ("Solver.xla!Do_Main")
' End the macro.
End Sub
RE: How to determine if SOLVER Add In is installed
I got the idea. My confusion came from VBA counting only visible workbooks and ignoring add-ins. If you have one regular workbook and a few add-ins open the
workbooks.count = 1, and
strName = workbooks(2).name will cause an error. But apparently if you call add-in by the name ( workbooks("Solver.xla") ) it's still accessible.