On Error Statements

You can use the "On Error" statement to specify which type of error handler to use when a run-time error occurs.

On Error { GoTo [ line | 0 | -1 ] | Resume Next } 

There are 3 choice:
1) On Error GoTo 0 - this interrupts your code with a dialog box. This is the default when no error handler is specified.
2) On Error Resume Next - this ignores all run-time errors. This is not recommended.
3) On Error GoTo LineLabel - this lets you provide a custom error handler.


On Error GoTo 0

This is the default error handler which interrupts execution and displays a dialog box.

On Error GoTo 0 

Disables enabled error handler in the current procedure and resets it to Nothing. more


On Error Resume Next

On Error Resume Next 

This statement allows execution to continue when a run-time error occurs. more


On Error GoTo LineLabel

On Error GoTo LineLabel 
LineLabel:

Execution jumps to the line label when an error occurs. more


On Error GoTo -1

Clears the error handling allowing you to define another error trap. more


Resume Statement

Allows you to resume execution after a run-time error occurs. more


© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext