无法将自定义属性添加到Excel工作簿

无法将自定义属性添加到Excel工作簿,excel,matlab,activex,Excel,Matlab,Activex,Excel工作簿有一个CustomDocumentProperties集合。这个集合属于DocumentProperties类型,并且有一个Add方法,我正试图从MATLAB调用该方法 如果对集合调用invoke方法,我会看到: >> workbook.CustomDocumentProperties.invoke Item = handle Item(handle, Variant, int32) Add = handle Add(handle, string, b

Excel工作簿有一个
CustomDocumentProperties
集合。这个集合属于
DocumentProperties
类型,并且有一个
Add
方法,我正试图从MATLAB调用该方法

如果对集合调用
invoke
方法,我会看到:

>> workbook.CustomDocumentProperties.invoke
    Item = handle Item(handle, Variant, int32)
    Add = handle Add(handle, string, bool, int32, Variant(Optional))
我假设这意味着
Add
方法需要一个字符串、布尔值、
int32
和一个可选变量,这与
Add
方法的匹配

但是,我尝试使用此函数的所有输入组合都会导致错误。例如:

workbook.CustomDocumentProperties.Add('MyProp', true, int32(1), true);
导致错误的原因:

Invoke Error: Incorrect number of arguments
Error: Invalid number is arguments. This method can take maximum 6 arguments
No method 'Add' with matching signature found for class 'Interface.2DF8D04D_5BFA_101B_BDE5_00AA0044DE52'.
如果我提供7个或更多参数,则会出现以下错误:

Invoke Error: Incorrect number of arguments
Error: Invalid number is arguments. This method can take maximum 6 arguments
No method 'Add' with matching signature found for class 'Interface.2DF8D04D_5BFA_101B_BDE5_00AA0044DE52'.
如果我将字符串以外的任何内容作为第一个参数,则会出现错误:

Invoke Error: Incorrect number of arguments
Error: Invalid number is arguments. This method can take maximum 6 arguments
No method 'Add' with matching signature found for class 'Interface.2DF8D04D_5BFA_101B_BDE5_00AA0044DE52'.
是否有人成功地使用此函数从MATLAB向Excel工作簿添加自定义属性