I have a problem to pass 2 parameters to a sub!!!
Like this:
welcom("hej", "asd")

Sub welcom(qwe, asd)
MsgBox(qwe)
MsgBox(asd)
End Sub

and I get an error
When I work with one parameter I works fine...
Help!

Re: How to call a sub with two parameters??? by Torgeir

Torgeir
Thu Dec 04 07:15:49 CST 2003

zurg wrote:

> I have a problem to pass 2 parameters to a sub!!!
> Like this:
> welcom("hej", "asd")
>
> Sub welcom(qwe, asd)
> MsgBox(qwe)
> MsgBox(asd)
> End Sub
>
> and I get an error
> When I work with one parameter I works fine...

Hi

You get this one:
Microsoft VBScript compilation error: Cannot use parentheses when calling a Sub



Try this instead:

welcom "hej", "asd"



--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter



Re: How to call a sub with two parameters??? by Adam

Adam
Thu Dec 04 07:19:55 CST 2003

In article <uAePKPmuDHA.1340@TK2MSFTNGP09.phx.gbl>, "zurg"
<zurg123@wp.pl> wrote in microsoft.public.scripting.vbscript:
> I have a problem to pass 2 parameters to a sub!!!
> Like this:
> welcom("hej", "asd")
[...]
> and I get an error
> When I work with one parameter I works fine...

Indeed. The error in question will be `Cannot use parentheses when
calling subs'. Have you tried removing the parentheses that *it* *told*
*you* *are* *wrong*?

hth

Adam
--
It's appositival, if it's there. And it doesn't have to be there.
And it's really obvious that it's there when it's there.
-- Larry Wall in <199709032332.QAA21669@wall.org>

Re: How to call a sub with two parameters??? by zurg

zurg
Thu Dec 04 07:30:21 CST 2003

So stupid mistake... agrhhh!
Thank you once again...



Re: How to call a sub with two parameters??? by Jor

Jor
Mon Jan 05 21:52:20 CST 2004

You can't use parentheses

"zurg" <zurg123@wp.pl> wrote in message
news:uAePKPmuDHA.1340@TK2MSFTNGP09.phx.gbl...
> I have a problem to pass 2 parameters to a sub!!!
> Like this:
> welcom("hej", "asd")
>
> Sub welcom(qwe, asd)
> MsgBox(qwe)
> MsgBox(asd)
> End Sub
>
> and I get an error
> When I work with one parameter I works fine...
> Help!
>
>



Re: How to call a sub with two parameters??? by Al

Al
Mon Jan 05 22:39:09 CST 2004


"Jor" <bjorgenson(At)charter(dot)net> wrote in message
news:vvkc7q7umaii5c@corp.supernews.com...
> You can't use parentheses

Not exactly...

> "zurg" <zurg123@wp.pl> wrote in message
> news:uAePKPmuDHA.1340@TK2MSFTNGP09.phx.gbl...
> > I have a problem to pass 2 parameters to a sub!!!
> > Like this:
> > welcom("hej", "asd")

You need to use one of the two following constructs:

welcom "hej", "asd"


or:

call welcom("hej", "asd")

/Al

> > Sub welcom(qwe, asd)
> > MsgBox(qwe)
> > MsgBox(asd)
> > End Sub
> >
> > and I get an error
> > When I work with one parameter I works fine...
> > Help!
> >
> >
>
>