Part | Description | |
Call | Optional; keyword. If specified, you must enclose argumentlist in parentheses. For example: | |
Call MyProc(0) | ||
name | Required. Name of the procedure to call. | |
argumentlist | Optional. Comma-delimited list of variables, arrays, or expressions to pass to the procedure. 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. |
' Call a Sub procedure.
Call PrintToDebugWindow("Hello World")
' The above statement causes control to be passed to the following
' Sub procedure.
Sub PrintToDebugWindow(AnyString)
Debug.Print AnyString ' Print to Debug window.
End Sub
' Call an intrinsic function. The return value of the function is
' discarded.
Call Shell(AppName, 1) ' AppName contains the path of the
' executable file.
' Call a Microsoft Windows DLL procedure. The Declare statement must be
' Private in a Class Module, but not in a standard 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
' Call a Macintosh code resource.
Declare Sub MessageAlert Lib "MyHd:MyAlert" Alias "MyAlert" (ByVal N _
As Integer)
Sub CallMyCodeResource()
Call MessageAlert(0) ' Call Macintosh code resource.
MessageAlert 0 ' Call again without Call keyword.
End Sub