Connecting Tech Pros Worldwide Forums | Help | Site Map

Subroutines multiple arguments

jim
Guest
 
Posts: n/a
#1: Nov 21 '08
Hi,

This might be a dumb question but i'm trying to pass a couple of
arguments to a subroutine and keep getting an error message

This:

Sub showNumbers(a As Integer)
MsgBox (a & ", " & a)

End Sub


Private Sub Command0_Click()
showNumbers (1)

End Sub

Works Fine!




But This:

Sub showNumbers(a As Integer, b As Integer)
MsgBox (a & ", " & b)

End Sub

Private Sub Command0_Click()
showNumbers (1, 2)

End Sub

gives a syntax error..

Any help much appreciated..

thanks

jim




paii, Ron
Guest
 
Posts: n/a
#2: Nov 21 '08

re: Subroutines multiple arguments


Try calling like this

showNumbers 1,2


"jim" <jim@j.comwrote in message
news:crCdnYXkn-OkTLvUnZ2dnUVZ8jOdnZ2d@posted.metronet...
Quote:
Hi,
>
This might be a dumb question but i'm trying to pass a couple of
arguments to a subroutine and keep getting an error message
>
This:
>
Sub showNumbers(a As Integer)
MsgBox (a & ", " & a)
>
End Sub
>
>
Private Sub Command0_Click()
showNumbers (1)
>
End Sub
>
Works Fine!
>
>
>
>
But This:
>
Sub showNumbers(a As Integer, b As Integer)
MsgBox (a & ", " & b)
>
End Sub
>
Private Sub Command0_Click()
showNumbers (1, 2)
>
End Sub
>
gives a syntax error..
>
Any help much appreciated..
>
thanks
>
jim
>

Closed Thread