On Error

This statement enables and disables error handling.

Syntax1

On Error Resume Next

Syntax2

On Error Goto 0

Remarks

If you do not use an On Error Resume Next statement, any run-time error that occurs is fatal; that is, an error message displays and execution of the current procedure stops.

An On Error Resume Next statement becomes inactive when another procedure is called, so you should execute an On Error Resume Next statement in each called routine if you want inline error handling within that routine.

On Error Goto 0 turns off inline error handling and enables errors to halt execution of your code.