I would like to pass an array to a sub and have the following code:
Public Sub callMySub(inputData() as string)
'some lines of code
End Sub
From inside another sub I have...
Dim theData() As String
theData = Split(Text1.Text, vbCrLf)
callMySub (theData())
I dont need to make any changes to the data in the array that is being
passed.
I just need to step thru the array looking for a particular string.
I get an error message saying "array argument must be by reference"
Can someone explain what I'm doing wrong.
Thanks
Charles W
Norm Cook - 29 Jul 2008 12:47 GMT
>I would like to pass an array to a sub and have the following code:
>
[quoted text clipped - 14 lines]
>
> Can someone explain what I'm doing wrong.
Change the line callMySub (theData()) to:
Either
callMySub theData() or callMySub theData
Or
Call callMySub (theData()) or Call callMySub (theData)
Just my $.02 but the name of the function (callMySub)
is somewhat confusing. I would change it to something
like MySub or something more descriptive of what it does
to the string array.
charles@home.com - 29 Jul 2008 13:52 GMT
Thanks.
Charles W
>>I would like to pass an array to a sub and have the following code:
>>
[quoted text clipped - 25 lines]
> like MySub or something more descriptive of what it does
> to the string array.