View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default How to run Solver from Visual Basic?

If you are opening excel from access using automation, then addins are not
loaded automatically to speed things up.

Here is some sample Excel code to add the solver addin and crate a reference
to it:
(written by Dana DeLouise)

Sub SolverInstall()
'// Dana DeLouis
Dim wb As Workbook

On Error Resume Next
' Set a Reference to the workbook that will hold Solver
Set wb = ActiveWorkbook

With wb.VBProject.References
.Remove .Item("SOLVER")
End With

With AddIns("Solver Add-In")
.Installed = False
.Installed = True
wb.VBProject.References.AddFromFile .FullName
End With
End Sub

http://support.microsoft.com/default...b;en-us;843304
How to create Visual Basic macros by using Excel Solver in Excel 97

--
Regards,
Tom Ogilvy


"Dinosaur51" wrote:

I have an Access database application that creates an excel application, an
excel spreadsheet and formats all the data in the appropriate rows and
columns of a worksheet. I would like to launch Solver from the new excel
application, but I cannot run it. I have loaded solver in my references, and
if I look through the addins of the newly created spreadsheet, it's there. Of
course, Access itself does not recognize the solver addin.
Any ideas (including how to generate excel modules from an access program,
then execute the resulting module)? Alternatively, is there a similar addin
for Access (sorry that this is not the forum for that)?
Thanks