ErrorHandle



Private Sub Command1_Click()
Dim i As Integer
On Error GoTo Error1
i = 1 / 0 ' Divide by zero.
Error1Resume:
On Error GoTo Error2
i = 1000000 ' Too big--overflow.
Error2Resume:
MsgBox "Finishing."
' Do not fall through into the error handlers!

Exit Sub
Error1:
' Resume ends error handler mode.

MsgBox "First error handler."
Resume Error1Resume
Error2:
' Resume ends error handler mode.

MsgBox "Second error handler."
Resume Error2Resume
End Sub


(errorhandle.html)- by Paolo Puglisi - Modifica del 25/3/2019