OLE Automation Excel
I posted a previous thread which asked how to use the Solver add in included in excel in the VB6 environemnt in order to solve an equation with 3 unkowns. In short, I use solver to minimize the sum of the squares.
In thinking about the problem I think I can do this by openning an excel workbook in VB which has the solver included as a recorded macro. I would then dump my data onto the excel workbook and use a shortcut key to launch the solver macro. I am unsure if this will work or how to do this ==> Open an existing file and type the shortcut key in excel without the user being aware of it. Any suggestions would be appreciated.
If you know how to call the solver add in in Excel from a VB6 application that would do as well.
June 10th, 2003, 12:28 AM
If you write the solver macro, you should be able to "call" the function from your code.
How can I soar like an eagle when
I'm flying with turkey's?
June 10th, 2003, 08:59 AM
I have this macro saved in personal.xls which from my understanding is loaded in the background everytime excel is launched.
If I launch Excel via:
I am assuming I can run this Macro since it should be saved and loaded unto my current instance of Excel. How would I call it from my VB environment? ie Call objxl.Solver_Mac
Set objXl = CreateObject("Excel.Sheet")
Set objXl = objXl.Application.ActiveWorkbook.ActiveSheet
SolverOk SetCell:="$F$1", MaxMinVal:=2, ValueOf:="0", ByChange:= _
Last edited by ofunkym; June 10th, 2003 at 09:01 AM.
June 10th, 2003, 10:39 AM
Thanks for the help I was able to call the macro by saving it in personal.xls and using the line:
All is well.