Unable to add custom properties to an Excel Workbook

﹥>﹥吖頭↗ 提交于 2019-12-12 20:25:32

问题


Excel workbooks have a CustomDocumentProperties collection. This collection is of type DocumentProperties and has an Add method that I'm attempting to call from MATLAB.

If I call the invoke method on the collection I see:

>> workbook.CustomDocumentProperties.invoke
    Item = handle Item(handle, Variant, int32)
    Add = handle Add(handle, string, bool, int32, Variant(Optional))

I assume this means the Add method requires a string, boolean, int32, and an optional variant, and this matches with the Microsoft documentation for the Add method.

However, all combination of inputs I've tried to this function result in an error. For example:

workbook.CustomDocumentProperties.Add('MyProp', true, int32(1), true);

Results in the error:

Invoke Error: Incorrect number of arguments

If I supply 7 or more arguments then I get the error:

Error: Invalid number is arguments. This method can take maximum 6 arguments

If I supply anything other than a string as the first argument I get the error:

No method 'Add' with matching signature found for class 'Interface.2DF8D04D_5BFA_101B_BDE5_00AA0044DE52'.

Has anyone successfully used this function to add a custom property to an Excel workbook from MATLAB?

来源:https://stackoverflow.com/questions/21688934/unable-to-add-custom-properties-to-an-excel-workbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!