Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with optional parameters in Excel Automation Add-in worksheet function
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel problem - sumif with multiple parameters | Excel Worksheet Functions | |||
Excel 2003 c++ automation problem. | Excel Worksheet Functions | |||
RP - Office 2000 automation parameters Access and excel | Excel Programming | |||
Office 2000: excel to access automation and parameters | Excel Programming | |||
addin problem: sheet mismatch by function parameters | Excel Programming |