I have a number of subroutines that accept a ParamArray for an indeterminate number of parameters, viz:
It doesn't seem to matter how I try to pass the array from PrintList to CheckList, I always seem to end up with something other than the array I started with. It starts off as an array of variants and appears to become a one element array of (an array of variants). That is, in CheckList, vList(0) contains the original array that was passed to PrintList.
This can go more than one level deep. In actuality, PrintList may be called directly or it may be called by another subroutine that has a ParamArray vList(). When that happens, CheckList receives a one element array of (a one element array of (an array of variants)).
It seems messy to have to write code to potentially unpack the array at each level. What is the way of passing a ParamArray to a ParamArray and ending up with exactly the same ParamArray?
Cross-posted here:
https://www.excelforum.com/excel-pr...to-another-sub-that-accepts-a-paramarray.html
Code:
Sub CheckList(ParamArray vList())
'
' checks stuff
'
End Sub
Sub PrintList(sMessage as String, ParamArray vList())
'
' prints stuff
'
CheckList vList
CheckList vList()
CheckList Array(vList())
End Sub
It doesn't seem to matter how I try to pass the array from PrintList to CheckList, I always seem to end up with something other than the array I started with. It starts off as an array of variants and appears to become a one element array of (an array of variants). That is, in CheckList, vList(0) contains the original array that was passed to PrintList.
This can go more than one level deep. In actuality, PrintList may be called directly or it may be called by another subroutine that has a ParamArray vList(). When that happens, CheckList receives a one element array of (a one element array of (an array of variants)).
It seems messy to have to write code to potentially unpack the array at each level. What is the way of passing a ParamArray to a ParamArray and ending up with exactly the same ParamArray?
Cross-posted here:
https://www.excelforum.com/excel-pr...to-another-sub-that-accepts-a-paramarray.html