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.CallPrintToDebugWindow("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 a Visual Basic run-time function (Shell), discard the return value.CallShell("C:\WINNT\system32\calc.exe", AppWinStyle.NormalFocus)' The preceding path is for Windows 2000; ' The Windows XP path C:\Windows\system32\calc.exe. ' Call a Microsoft Windows DLL procedure. The Declare statement must be ' Private in a class, not in a module. Private Declare Sub MessageBeep Lib "User32" (ByVal N As Integer) Sub CallMyDll()CallMessageBeep(-1)' Call Windows DLL procedure. MessageBeep(-1) ' Call again without Call keyword. End Sub