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 ExchangeData 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