Resume (statement)

<< Click to Display Table of Contents >>

Resume (statement)

Resume [0]

Or:

Resume Next

Or:

Resume Label

Ends an error handling routine called by the On Error statement and continues execution of the script.

See also: On Error

Example:

Sub Main

 On Error Goto MyErrorHandler

 Print 1/0     ' Causes a "division by zero" error

 MsgBox "End"

 Exit Sub

MyErrorHandler:            ' Error-handling routine

 Dim DgDef, Msg, Response, Title

 Title = "Error"

 Msg = "A runtime error has been raised. Do you want to resume execution?"

 DgDef = MB_YESNO + MB_ICONEXCLAMATION

 Response = MsgBox(Msg, DgDef, Title)

 If Response = IDYES Then

         Resume Next

 Else

         Stop

 End If

End Sub