Exit Sub (statement)

Syntax Exit Sub
Description Causes execution to exit the current subroutine, continuing execution on the statement following the call to this subroutine.
Comments This statement can appear anywhere within a subroutine. It cannot appear within a function.
Example This example displays a dialog box and then exits. The last line should never execute because of the Exit Sub statement.
Sub Main()
  MsgBox "Terminating Main()."
  Exit Sub
  MsgBox "Still here in Main()."
End Sub
See Also Stop (statement); Exit For (statement); Exit Function (statement); Exit Do (statement); End (statement); Do...Loop (statement).