Passing parameter arrays by value

  • Thread starter Thread starter max
  • Start date Start date
M

max

how do I pass a parameter array by value instead of by ref
to a procedure? ie
function myfunction(byval paramarray MyparamArraysName)
 
You can't do it by val, since a "copy" of the array will a have to be made.

Public Sub test2()

Dim a(200) As Integer

Call test3(a)

End Sub


Public Sub test3(bb() As Integer)

MsgBox "count in array size = " & UBound(bb, 1)


End Sub

The above will result in 200 displayed. However, arrays must be passed by
ref.
 
I believe you can do it by storing the array in a variant & passing the
variant byval. Alternatively, try enclosing the array name in brackets & see
if that works.

HTH,
TC
 
Back
Top