What does the Call keyword do in VB6?

From the MSDN:

You are not required to use the Call
keyword when calling a procedure.
However, if you use the Call keyword
to call a procedure that requires
arguments, argumentlist must be
enclosed in parentheses. If you omit
the Call keyword, you also must omit
the parentheses around argumentlist.
If you use either Call syntax to call
any intrinsic or user-defined
function, the function’s return value
is discarded.

For example:

Sub Proc1()
    Debug.Print "Hello World"
End Sub

Sub Proc2(text As String)
    Debug.Print "Hello " & text
End Sub

In the immediate window, if you enter

Proc1

then “Hello World” prints. If you enter

Call Proc1

then “Hello World” prints. If you enter

Proc2 "World"

then “Hello World” prints. If you enter

Call Proc2 "World" 

you get a compile error. You would have to enter

Call Proc2("World")

Leave a Comment