UDF optional argument

Add-in Express™ Support Service
That's what is more important than anything else

UDF optional argument
Would like to use optional argument in a UDF via an XLL addin 
Steven Verze




Posts: 4
Joined: 2008-09-11
Hi,

I am developing an XLL add-in in C#.
Is it possible to specify that an argument(s) is optional in a UDF?
I believe it is possible in VBA, the only proviso is that the optional arguments are all at the end of the function signature.

Regards

Steven
Posted 11 Sep, 2008 10:29:07 Top
Eugene Astafiev


Guest


Hi Steven,

Sure, you can specify a parameter in the function declaration as optional. For such purpose you can use the System.Runtime.InteropServices.OptionalAttribute attribute. In the UDF function you can check up the argument in the following way:

if (arg is System.Reflection.Missing)
{
    System.Windows.Forms.MessageBox.Show("optional");
}
Posted 11 Sep, 2008 16:33:29 Top