Problems Running Excel Solver Makro from Matlab

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2021년 9월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by