View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Charles Williams Charles Williams is offline
external usenet poster
 
Posts: 968
Default Passing ParamArray to another function converts it to TWO dimensions.

I think this is the recommended method for passing a paramarray argument to
a sub or function

Option Explicit
Function tester(arg1 As Variant, ParamArray arg2() As Variant)
Dim vv As Variant

vv = arg2

tester = test2(vv)

End Function

Function test2(varg As Variant)
test2 = varg
End Function

regards
Charles
__________________________________________________
Outlines for my Sessions at the Australia Excel Users Group
http://www.decisionmodels.com/OZEUC.htm

wrote in message
...
If I set watch points for Params and SubParams below, I find that
Params has one dimension but SubParams has TWO:

Function Func(ParamArray Params) as String
... = SubFunc(Params)
End Function

Function SubFunc(ParamArray SubParams) as String
...
End Function

The following (to me) ludicrous kludge fixes the problem, making
SubParams the nice, obedient 1-dim array equivalent to Params that it
should be:

Function Func(ParamArray Params)
... = SubFunc(Params(0))
End Function

What in HELL is this? String theory?

***