How to pass arrays in Function Calls?
Mac,
Firstly, if you want to assign "Won" to an element in your array you'll have
to declare it as type string, not integer. That may be your problem there.
Also note that an array declared arr(3) has 4 elements, not 3. (0 is the
first unless option base is specified.)
Your Arg doesn't appear to be doing anything, maybe you meant Function
Testx() as <type ?
Otherwise I can see no reason your code wouldn't run.
-Mike
"Mac Lingo" wrote in message
m...
This code dies at the "Msgbox" Line.
Can you give me an idea why. And what do I do to make it work as it
should?
Function Testx(Arg)
' Function should return the word "Won".
Dim Cols(3) As Integer
Call Testy(Cols())
Testx = Cols(1)
End Function
Sub Testy(Cols() As Integer)
Cols(1) = "Won"
MsgBox "Done" <-- Calling never gets to this line.
End Sub
Thanks,
Mac Lingo
Berkeley, CA
|