Transfers control to a Sub procedure, Function procedure, or dynamic-link library (DLL) procedure.
[ Call ] ProcedureName[(ArgumentList)]
You are not required to use the Call keyword when calling a procedure; however, if you use the Call statement to call any intrinsic, DLL, or user-defined function, the function's return value is discarded.
This example illustrates how the Call statement is used to transfer control to a Sub procedure, an intrinsic function, and a dynamic-link library (DLL) procedure.
' Call a Sub procedure.Call
PrintToDebugWindow(
"Hello World")
' The above statement passes control to the following Sub procedure. Sub PrintToDebugWindow(ByVal AnyString As String) Debug.WriteLine(AnyString) ' Print to the Output window. End Sub ' Call an intrinsic function. The return value is discarded.Call
Shell(
"C:\Windows\calc.exe", AppWinStyle.NormalFocus)
' Call a Microsoft Windows DLL procedure. The Declare statement must be ' Private in a class, not in a module. Private Declare Sub MessageBeep Lib "User" (ByVal N As Integer) Sub CallMyDll()Call
MessageBeep(
0)
' Call Windows DLL procedure. MessageBeep(0) ' Call again without Call keyword. End Sub