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
|
|
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");
}
|
|