Click to See Complete Forum and Search --> : I'm trying to use a procedure with to arguments. But there is an error: "expected: ="


Sharkky
July 30th, 2003, 01:59 PM
I'm trying to use a procedure with to arguments. But there is an error: "expected: =" (VBA)

I'm writting exactly following code

Sub Multiply(x as Integer, y as Integer)
????1.CommandButton1.Caption = x * y
End Sub

In the required place I write:
Multiply (5, 6)


And the result - ERROR

What should I do? Or it is impossible to use procedure with to arguments in VBA???

savanora
July 31st, 2003, 03:47 PM
'Try like this;

Private Sub Command1_Click()
Multiply 5, 6
End Sub

Sub Multiply(x As Integer, y As Integer)
Command1.Caption = x * y
End Sub


'or ;

Private Sub Command1_Click()
Call Multiply(5, 6)
End Sub

Sub Multiply(x As Integer, y As Integer)
Command1.Caption = x * y
End Sub