Excel custom properties Add function - Invoke Error: Incorrect number of arguments
2 次查看(过去 30 天)
显示 更早的评论
Excel workbooks have a CustomDocumentProperties collection. This collection is of type DocumentProperties and these collection have an Add method.
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, bool, int32 and an optional variant and this matches with the Microsoft documentation for the Add method (<http://msdn.microsoft.com/en-us/library/office/ff862806.aspx)>.
However, all combination of inputs I've tried to this function result in the error:
Invoke Error: Incorrect number of arguments
except if I supply 7 or more arguments when I get the error:
Error: Invalid number is arguments. This method can take maximum 6 arguments
or if I supply anything other than a string as the first argument which results in 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?
1 个评论
Joel
2014-9-25
Did you ever find a solution to this issue? I've run into the same problem.
In addition, if I open an existing document that already has custom properties, I have an identical issue with the Item method. its also odd that it wants 2 parameters in addition to the handle since the documentation says it should be called with one parameter; either a string or a numerical index.
回答(1 个)
Chris Hooper
2019-7-3
I am very interested in this as well. I am trying to use optional arguments for the Range.Find() method in order to specify that I want an exact match (not a partial match). I cannot get any optional arguments to work, such as this:
fi_excelSheet.Cells.Find('a',[],[],'xlWhole',[],[],[],[],[]).value
I get the error:
Error using Interface.00020846_0000_0000_C000_000000000046/Find
Invoke Error, Dispatch Exception: Type mismatch.
Help!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 ActiveX 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!