Excel custom properties Add function - Invoke Error: Incorrect number of arguments
2 views (last 30 days)
Show older comments
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 Comment
Joel
on 25 Sep 2014
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.
Answers (1)
Chris Hooper
on 3 Jul 2019
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 Comments
See Also
Categories
Find more on ActiveX in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!