PDA

View Full Version : Solved: Solver.xla



starl
08-22-2004, 04:52 PM
Have a sub using solver.xla. The project has a reference to solver, but the location may vary and so it doesn't always find the addin..

is there a way of declaring solver.xla explicitly?
another solution?

Jacob Hilderbrand
08-22-2004, 05:03 PM
See if this works for you:


AddIns("Solver Add-in").Installed = True

starl
08-22-2004, 05:16 PM
It's already there, but doesn't do it all....
I didn't write the program - I'm just a tester - so when I look at my references, it says that solver is missing.
If this was Word, I would just refer to Word explicitly.. but I have no idea how to do it with this.

Jacob Hilderbrand
08-22-2004, 05:28 PM
Ok, well... If Solver is not installed then we may have trouble.

Tools | Add-Ins...

Is Solver in the list? If not then:

Close Excel
Insert Office CD
Add or Remove Features
Click the plus sign (+) next to Microsoft Excel for Windows
Click the plus sign (+) next to Add-ins and Solver
Select Run From My Computer
Click Update Now

starl
08-22-2004, 07:22 PM
ah.. so it happens because solver is completely uninstalled. If it's installed by Excel, but not checked, vba will still find it.

hmm.. is there a way to force it's installation? I have a custom Excel install, so I'm not sure, but is it installed on the pc by default (just not checked in addins?)

Jacob Hilderbrand
08-22-2004, 07:41 PM
If you just choose the standard Office install, I don't believe that it will be installed. You have to choose it to be installed.

If it is not chosen to be installed, it wil not be on the PC at all.

If it is insalled, it will be in the Add-Ins list and VBA can find it and install/uninstall it for use.

starl
08-22-2004, 07:45 PM
ok - I think I got what I needed... so if the user has it installed (and it HAS to be done on purpose), the macro will have no problems. But, if it's never been installed, then the code needs to tell the user - because the code can't force it.

Jacob Hilderbrand
08-22-2004, 07:51 PM
Right. You can do something like:


On Error Resume Next
AddIns("Solver Add-in").Installed = True
If Err <> 0 Then
MsgBox "Excel's Solver Add-in is not installed, " & _
"You must install it from the Excel installation CD " & _
"for this macro to function properly.", vbCritical, "Error"
Exit Sub
End If
On Error GoTo 0