Thread: VB solver
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default VB solver

AFAIK, it would be illegal for you to distribute the solver files
yourself. If the recipient has the product installed, the code below
should work. It has been tested *very* lightly. It also assumes the
necessary security permissions are available. Obviously, it would
benefit from additional code to respond gracefully to the absence of
Solver.

Sub testSolverRef()
On Error Resume Next
ThisWorkbook.VBProject.References.Remove _
ThisWorkbook.VBProject.References("Solver")
ThisWorkbook.VBProject.References.AddFromFile _
Application.AddIns("Solver Add-in").FullName
On Error GoTo 0
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
What can be done to make a VB solver invoked routine work across versions of
Excel? Currently the VB code that I write in an Excel 2000 app will not fly
when I open the sheet in Excel 2002 nor will a 2002 app fly when brought over
to a 2000 excel installation (the VB code however is the same). I realize
that the solver file and probably the solver.dll being used by these 2
versions is different, but how can I get around this without distributing a
solver.xla and solver.dll file to force into some other user's machine with
every app. I send?