Problems Running Excel Solver Makro from Matlab
Afficher commentaires plus anciens
Hey everybody,
I try to run a macro, which runs Excel Solver, from Matlab.
I successfully created the interface, but everytime the solver returns the error: Error in Model. Please verify that all cells and constraints are valid. If I start the makro by hand in Excel, it works perfectly. So I think it has something to do with the cell selection or similar.
This is my Matlab code:
hExcel = actxserver('Excel.Application');
WB = hExcel.Workbooks.Open("file.xlsm");
hExcel.Run('SolverTest');
WB.Save
WB.Saved=1;
WB.Close
Quit(hExcel)
delete(hExcel)
And this is my Excel Makro:
Sub SolverTest()
'
' SolverTest Makro
ActiveWorkbook.Sheets("Balance").Select
SolverOk SetCell:="$D$15", MaxMinVal:=3, ValueOf:=0, ByChange:="$B$24", Engine _
:=1, EngineDesc:="GRG Nonlinear"
SolverSolve
End Sub
Has anyone here ever tried to use Solver via Matlab? I only found one thread about this, but with a different problem and no ideas for my solution.
Thank you in advance!
Greetings,
Angy
Réponses (0)
Catégories
En savoir plus sur Data Import from MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!