"cannot assign values to an array"
Hi Experts,
When I call a function that returns an array, and try to assign the returned array to a variable, I get an error message saying "cannot assign values to an array".
The following is a simplified version of what try to do, just to highlight the problem:
'1. I create a function called gen_array(s1 as String, s2 as String)
'2. In a test() function I try to call the above gen_array(s1, s2), then the error occurs.
Function gen_array(s1 As String, s2 As String) As String
Dim a(2) As String
a(0) = s1
a(1) = s2
gen_array = a
End Function
Function test()
Dim s(2) As String
s = gen_array("jim", "liu")
MsgBox (s(0))
End Function
Your help is greatly appreciated.
best regards
Jim