Octave:无法将可选参数传递给 VBA 函数(当通过 COM 服务器添加 excel 工作表时)

Octave: Unable to pass optional arguments into VBA function (when adding excel sheets via COM server)

我正在尝试将工作表添加到 excel 文件。

它应该相当简单;但是,当尝试使用空大括号跳过可选参数时,下面的最小工作示例失败。 (这不对吗? 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, 0, 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 一直有效,直到跳过第一个输入。方括号是跳过输入的错误方法吗?

Original source.

我也在 Octave forum 中发布了这个。

根据问题下的评论,
这是一个错误,has been reported by OP and fixed in the development branch.