IsMissing (function)




Returns True if variable was passed to the current subroutine or function; returns False if omitted.


The IsMissing is used with variant variables passed as optional parameters (using the Optional keyword) to the current subroutine or function. For non-variant variables or variables that were not declared with the Optional keyword, IsMissing will always return True.


The following function runs an application and optionally minimizes it. If the optional isMinimize parameter is not specified by the caller, then the application is not minimized.

Sub Test(AppName As String,Optional isMinimize As Variant)
  app = Shell(AppName)
  If Not IsMissing(isMinimize) Then
    AppMinimize app
    AppMaximize app
  End If
End Sub

Sub Main
  Test "notepad.exe"          'Maximize this application
  Test "notepad.exe",True     'Minimize this application
End Sub

See Also

Declare (statement), Sub...End Sub (statement), Function...End Function (statement)

More information