Excel Solver disabled by Matlab

2 ビュー (過去 30 日間)
Michael Burnett
Michael Burnett 2016 年 9 月 27 日
回答済み: Ayush 2024 年 10 月 3 日
I am using Matlab to open an Excel worksheet in which Excel Solver has been added. However when Matlab opens the worksheet the Solver tab does not appear in the worksheet, even though it is enabled in the Excel setup. If I open the same worksheet manually Solver appears as it should. What can I do to keep Matlab from disabling Solver?

回答 (1 件)

Ayush
Ayush 2024 年 10 月 3 日
You can try use MATLAB to explicitly load the Solver add-in when you open Excel. Here is the sample code for this:
% Start Excel application
excelApp = actxserver('Excel.Application');
excelApp.Visible = true;
% Open the workbook
filePath = fullfile(pwd, 'fileName.xlsx');
workbook = excelApp.Workbooks.Open(filePath);
% Access the Add-ins collection
addIns = excelApp.AddIns;
%Find and load the Solver add-in
for i = 1:addIns.Count
if strcmp(addIns.Item(i).Name, 'Solver Add-In')
if ~addIns.Item(i).Installed
addIns.Item(i).Installed = true;
end
break;
end
end
I hope this helps!

カテゴリ

Help Center および File ExchangeExcel Add-Ins についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by