如何解决Octave:无法将可选参数传递到 VBA 函数中通过 COM 服务器添加 Excel 表时
它应该相当简单;但是,当尝试使用空大括号跳过可选参数时,下面的最小工作示例失败。 (这不正确吗?Source 1 Source 2)
clc
clear
% if COM error occurs,excel process remains open.
% use task manager to end process,else 'a.xlsx' file remains "in use".
srvr = actxserver('excel.application');
wbks = srvr.workbooks;
pth = fullfile(pwd,'a.xlsx');
if ~exist(pth,'file')
wbk = wbks.add;
wbk.activate;
wbk.saveAs( pth );
wbk.close;
end
wbk = wbks.open( pth,false );
wbk.activate;
wshts = wbk.worksheets;
shts = wbk.sheets;
wsht = wshts.item(1);
wsht.activate;
sht = shts.item(1);
wsht.select(true);
sht.select(true);
%{
https://docs.microsoft.com/en-us/office/vba/api/excel.sheets.add
https://docs.microsoft.com/en-us/office/vba/api/excel.worksheets.add
%}
shts.add(sht); % functions
shts.add(wsht); % functions
shts.add([],sht); % fails
shts.add([],wsht); % fails
shts.count
wbk.save;
srvr.quit;
这里是错误:
error: com_invoke: property/method invocation on the COM object Failed with error `0x800a03ec' - Z
error: called from
trash at line 46 column 1
请注意,add
会在跳过第一个输入之前起作用。方括号是跳过输入的错误方法吗?
我也在 Octave forum 发布了这个。
解决方法
根据问题下的评论,
这是一个错误,由 OP 和 has been reported fixed in the development branch 提供。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。