M
Mike Gilkeson
I'm developing an Office Automation Add-in in C++/ATL (Visual Studio
..NET 2003) that exposes an Excel worksheet function. The function
takes 13 input parameters and I need 9 to be optional. I used the
optional attribute for the parameters in the IDL function declaration:
[id(1), helpstring("method TestFunction")] HRESULT TestFunction([in]
VARIANT RequiredParam1, [in] VARIANT RequiredParam2, [in] VARIANT
ArgumentList, [in] VARIANT Argument1, [in, optional] VARIANT
Argument2, [in, optional] VARIANT Argument3, [in, optional] VARIANT
Argument4, [in, optional] VARIANT Argument5, [in, optional] VARIANT
Argument6, [in, optional] VARIANT Argument7, [in, optional] VARIANT
Argument8, [in, optional] VARIANT Argument9, [in, optional] VARIANT
Argument10, [out,retval] VARIANT* returnValue);
When I run Excel the function shows up correctly. The function window
shows the first 4 parameters names in bold (meaning required) and the
rest not in bold but my code doesn't get called unless I fill in all
the parameters. I created Microsoft's sample Visual Basic Automation
Add-in, http://support.microsoft.com/default.aspx?kbid=285337, that
has a function with an optional parameter and the sample worked
correctly. I also tried calling my method from VB and that also worked
correctly (I didn't have to supply the optional parameters). Does
anyone have any idea what's wrong with Excel calling my method?
Thanks,
Mike Gilkeson
..NET 2003) that exposes an Excel worksheet function. The function
takes 13 input parameters and I need 9 to be optional. I used the
optional attribute for the parameters in the IDL function declaration:
[id(1), helpstring("method TestFunction")] HRESULT TestFunction([in]
VARIANT RequiredParam1, [in] VARIANT RequiredParam2, [in] VARIANT
ArgumentList, [in] VARIANT Argument1, [in, optional] VARIANT
Argument2, [in, optional] VARIANT Argument3, [in, optional] VARIANT
Argument4, [in, optional] VARIANT Argument5, [in, optional] VARIANT
Argument6, [in, optional] VARIANT Argument7, [in, optional] VARIANT
Argument8, [in, optional] VARIANT Argument9, [in, optional] VARIANT
Argument10, [out,retval] VARIANT* returnValue);
When I run Excel the function shows up correctly. The function window
shows the first 4 parameters names in bold (meaning required) and the
rest not in bold but my code doesn't get called unless I fill in all
the parameters. I created Microsoft's sample Visual Basic Automation
Add-in, http://support.microsoft.com/default.aspx?kbid=285337, that
has a function with an optional parameter and the sample worked
correctly. I also tried calling my method from VB and that also worked
correctly (I didn't have to supply the optional parameters). Does
anyone have any idea what's wrong with Excel calling my method?
Thanks,
Mike Gilkeson