Exit Function (statement)

Syntax Exit Function
Description Causes execution to exit the current function, continuing execution on the statement following the call to this function.
Comments This statement can only appear within a function.
Example This function displays a message and then terminates with Exit Function.
Function Test_Exit() As Integer
  MsgBox "Testing function exit, returning to Main()."
  Test_Exit = 0
  Exit Function
  MsgBox "This line should never execute."
End Function
Sub Main()
  a% = Test_Exit()
  MsgBox "This is the last line of Main()."
End Sub
See Also Stop (statement); Exit For (statement); Exit Do (statement); Exit Sub (statement); End (statement); Do...Loop (statement).