Language ReferenceCall Statement


Description
Transfers control to a Sub procedure or Function procedure.

Syntax
[Call] name [argumentlist]

The Call statement syntax has these parts:

Part Description
Call Optional keyword; if specified, you must enclose argumentlist in parentheses. For example:

Call MyProc(0)

name Name of the procedure to call.
argumentlist Comma-delimited list of variables, arrays, or expressions to pass to the procedure. Each argument in argumentlist should be preceded with the ByVal keyword indicating that the argument is being passed to the procedure by value. If ByVal is not specified for an argument, assignment to the argument within the procedure is not allowed.

Remarks

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.