If an error trap has been enabled in a procedure, it's automatically disabled when the procedure finishes running. However, you might want to turn off an error trap earlier. To turn off an enabled error trap, use the On Error GoTo 0 statement. You can use On Error GoTo 0 to turn off error handling anywhere in a procedure — even within an error handler.
For example, try single stepping through the following procedure.
Sub ErrDemoSub()
On Error GoTo SubHandler
' Error trapping is enabled.
' Errors need to be caught and corrected here.
Kill "OLDFILE.XYZ"
On Error GoTo 0 ' Error trapping is turned off here.
Kill "OLDFILE.XYZ"
On Error GoTo SubHandler ' Error trapping is enabled again.
Kill "OLDFILE.XYZ"
Exit Sub
SubHandler: ' Error handler goes here.
MsgBox "Caught error."
Resume Next
End Sub