B
Braden Craig
Hello,
I have a simple question. I would like to know how
to pass an array argument to a subroutine. I would like
to do something like the example below illustrates. (The
syntax for the below example is wrong and does not work
but should show the simple thing I am trying to do.)
I can program a workaround using ParamArray, but I would
prefer not to pass my args in this way. Instead of
listing all the args of my array in the ParamArray, I
would prefer to pack them into an array and pass them to
my subroutine using just the name of the array.
Thanks in advance for any help with this matter.
Braden Craig
Public Sub arrayPass()
Dim argArray(3) As Integer
argArray(0) = 12
argArray(1) = 13
testerSub (argArray)
End Sub
Public Sub testerSub(argArray() As Variant)
Dim test1 As Integer, test2 As Integer
test1 = argArray(0)
test2 = argArray(1)
End Sub
I have a simple question. I would like to know how
to pass an array argument to a subroutine. I would like
to do something like the example below illustrates. (The
syntax for the below example is wrong and does not work
but should show the simple thing I am trying to do.)
I can program a workaround using ParamArray, but I would
prefer not to pass my args in this way. Instead of
listing all the args of my array in the ParamArray, I
would prefer to pack them into an array and pass them to
my subroutine using just the name of the array.
Thanks in advance for any help with this matter.
Braden Craig
Public Sub arrayPass()
Dim argArray(3) As Integer
argArray(0) = 12
argArray(1) = 13
testerSub (argArray)
End Sub
Public Sub testerSub(argArray() As Variant)
Dim test1 As Integer, test2 As Integer
test1 = argArray(0)
test2 = argArray(1)
End Sub