Passing variables to Function problems

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
 
K

Klatuu

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)
 
P

Paul Overway

Yes...the parens are the problem. He either needs to exclude them, use
Call, or assign the function return to something.
 
P

Paul Overway

A simple test...in your immediate window

Right("whatever",1)

Then try...

Right "whatever",1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top