Array Parameters as Variants Only
Sub Main()
Dim arr() As Integer
Dim v As Variant
ReDim arr(1 To 3)
For i = 1 To 3
arr(i) = i
Next
v = DoNothing(arr)
For i = LBound(v) To UBound(v)
Debug.Print i, v(i)
Next
End Sub
Function DoNothing(ByRef ArrIn() As Integer)
DoNothing = ArrIn
End Function
works for me.
--
Regards,
Tom Ogilvy
"TheVisionThing" wrote in message
m...
Am I correct in my assumption that I can only pass arrays in the form of
variants to a procedure as a parameter.
For example, the following function always works for arrays
Function DoNothing(ByRef ArrIn as variant)
DoNothing = arrIn
End Function
While the following function never seems to work for arrays even if they
are
dimensioned as integer arrays.
Function DoNothing(ByRef ArrIn as integer)
DoNothing = arrIn
End Function
Regards,
Wayne C.
|