Excel ActiveX slow and stealing focus
19 ビュー (過去 30 日間)
古いコメントを表示
For several years now I'm using an activex server to export data to Excel spreadsheets. I recently upgraded to Matlab R2022b and since then there are two annoying things to this:
- Saving the workbook has become slower
- Saving the workbook shows a progress popup which steals the focus from all other applications running
I guess I can live with the slowdown (though suggestions to improve this are welcome), but the focus stealing makes it impossible to let my program run in the background. Can I somehow disable or work around the focus stealing behaviour?
I'm using the activex server somewhat like this:
hExcel = actxserver('excel.application');
for file = 1:many
hWorkbook = hExcel.Workbooks.Add();
% export data and formatting to worksheet
%
hWorkbook.SaveAs("TheFileName"); % This is where the popup happens
hWorkbook.Close(false);
end
hExcel.Quit;
hExcel.delete;
Update:
Just now noticed a question mark on the popup, which redirects me to this Microsoft support page. The title of the popup I see is "saving", so I looked at the "Opening or daving files" section. Although there are no external references as far as I know, just to be sure I added:
hWorkbook = hExcel.Workbooks.Add();
hWorkbook.UpdateRemoteReferences = false;
hWorkbook.UpdateLinks = 2; % xlUpdateLinksNever == 2 Embedded OLE links are never updated for the specified workbook
But that does not help.
0 件のコメント
回答 (2 件)
Image Analyst
2023 年 7 月 19 日
What is the visibility property? Try making it invisible right after you get it.
hExcel.Visible = false;
or something like that.
7 件のコメント
Image Analyst
2023 年 7 月 21 日
What do you see if you just start Excel by itself, without starting MATLAB? Does it ask you to login?
Can you ask your IT people if they can get a standalone version of Office that doesn't require you to login? With our IT, they could.
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!