jtseltmann
Programmer
I have a public function that processes some data manipulations. I wanted to create a new sub that does the "data conversions and checks". My sub is not returning the correct data and I cannot figure out why.
Here is a snippet...minus all the middle junk.
'----------------------------------------------
Public Function Import_CSV_file() as boolean
Dim varData as variant
CleanData(varData)
MsgBox varData
End function
Public Sub CleanData(varData as variant)
varData = Trim(varData)
varData = Replace(varData,",","")
End Sub
'----------------------------------------------
I had thought that if the data passed in varData was
" aaa,bbb,ccc " that when passed to CleanData it would be displayed as "aaabbbccc" but is it not. It is just as it was when it was passed to the routine.
Can anyone help me understand why? I thought I was using ByRef correctly but short of using CleanData as a function I don't know why? Isn't that the point of ByRef..?
Thanks for any insight
Here is a snippet...minus all the middle junk.
'----------------------------------------------
Public Function Import_CSV_file() as boolean
Dim varData as variant
CleanData(varData)
MsgBox varData
End function
Public Sub CleanData(varData as variant)
varData = Trim(varData)
varData = Replace(varData,",","")
End Sub
'----------------------------------------------
I had thought that if the data passed in varData was
" aaa,bbb,ccc " that when passed to CleanData it would be displayed as "aaabbbccc" but is it not. It is just as it was when it was passed to the routine.
Can anyone help me understand why? I thought I was using ByRef correctly but short of using CleanData as a function I don't know why? Isn't that the point of ByRef..?
Thanks for any insight