Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine if SOLVER Add In is installed 1

Status
Not open for further replies.

yakpol

Structural
Jun 1, 2001
450
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
 
Replies continue below

Recommended for you

in XL97, I think you could probably get this answer by searching for solver.xla.

I'm not sure about a more graceful solution, but I'll give it some pondering.
 
this may help (to check whether solver.xla has been opened):

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:


' 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
 
Thansk, Ivy!
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor