Thread
:
Excel - DotNet - Variant Arrays as Params
View Single Post
#
6
Posted to microsoft.public.excel.programming
onedaywhen
external usenet poster
Posts: 459
Excel - DotNet - Variant Arrays as Params
How about using a (large) number of optional variant arguments e.g.
Function Indifferent(ByRef Arg1 as Variant, _
Optional ByRef Arg2 as Variant, _
Optional ByRef Arg3 as Variant, _
...
Optional ByRef Arg30 as Variant)
I think this is how the SUM worksheet function is written. If you
*type* this in the VBE Immediate Window:
Application.WorksheetFunction.Sum(
when you type the parenthesis the IntelliSense kicks in to show one
mandatory and 29 option arguments.
--
(Paul S Bryant) wrote in message . com...
I agree that the elements in the Variant() array in the GoodFunction()
are indeed of type Range. This wouldn't help me pass data to DotNet
without the PIA, but it does confirm the thing I am immediately
interested in. That is, the Excel function bar can't pass parameters
to functions requiring variant arrays unless you use the ParamArray
modifier.
"Tom Ogilvy" wrote in message ...
I believe your interpretation of GoodFunction is incorrect. If you test
the typename of the first element of avVariant, it will be Range. No
conversion has taken place. Replace the argument with a single number, and
as written you will get the same result.
=GoodFunction(21)
Your interpretation of BadFunction is correct in that you have a mismatch
with argument type and the function is never entered.
Reply With Quote
onedaywhen
View Public Profile
Find all posts by onedaywhen