Example - Resume Statement

Sub Main

 On Error GoTo ErrorHandler   ' Enable Error-handling routine.

  Dim x, y, z As Integer

  x = 50

  y = 0

  z = x / y   ' Divide by ZERO Error Raises

  MsgBox z

Exit Sub

  ErrorHandler:    ' Error-handling routine.

  Select Case Err.Number   ' Evaluate Error number.

     Case 10   ' Divide by zero Error

        MsgBox ("You attempted to divide by zero!")

     Case Else

        MsgBox "UNKNOWN ERROR  - Error# " & Err.Number & " : " & Err.Description

         

  End Select

   

Resume Next

End Sub