Passing variables to Function problems

  • Thread starter Thread starter Gibson
  • Start date Start date
G

Gibson

I am trying to pass three variables to a function. In the sub I dim each as
a string, I set them to the appropriate value then I use the the next line
to call the function Test1. The variables are of course V1,V2,V3.

Test1(V1,V2,V3)

Function Test1(str2 As String, str3 As String, str4 As String)
code
End Function

If I use just one variable to pass it works fine. When I try to put 3 to
pass, that is to say when I put in the V2 and V3 in the calling statement I
get an error telling me a = is Expected. ("Expected: =") I assume one can
pass multiple variables to a function. Can someone enlighten me.
Thanks
 
The parens are not the problem, I don't think. If I take your post literally
and the = Expected error is what you are getting, then you are not assigning
the value returned by Test1 to anything. Try:

WhateverKindofDataIExpect = Test1(V1,V2,V3)
 
Yes...the parens are the problem. He either needs to exclude them, use
Call, or assign the function return to something.
 
A simple test...in your immediate window

Right("whatever",1)

Then try...

Right "whatever",1
 
Back
Top