Call Statement


[Call] procedurename [argumentlist]


Use: Optional


Use: Required

Data Type: n/a

The name of the subroutine being called.


Use: Optional

Data Type: Any

A comma-delimited list of parameters to pass to the subroutine being called.


Passes execution control to a procedure, function, or dynamic-link library (DLL) procedure.

Rules at a Glance

  • Components of argumentlist may include the keywords ByVal or ByRef to describe how the arguments are treated by the called procedure. However, ByVal and ByRef can be used with Call only when calling a DLL procedure defined with the Declare statement. ByRef indicates that the variable's address in memory, rather than its value, is to be passed to the external routine; this means that, should the external routine modify the variable's value, this change is reflected in the variable's value when the external DLL routine returns control to the calling procedure. ByVal, on the other hand, indicates that the parameter is passed to the DLL routine by value ; in other words, a copy of the value, rather than its location in memory, is passed to the external library routine. This means that, if the parameter is a variable, the external routine can't modify its value. (An exception is a string expression that's passed by value to a DLL routine. All strings are passed by reference to external DLLs; however, a string passed using the ByVal keyword is passed by reference as a C string; whereas ...

Get VB & VBA in a Nutshell: The Language now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.