Error handling in a nutshell

To help you keep all this error-handling business straight, I've prepared a quick-and-dirty summary. An error-handling routine has the following characteristics:

i It begins immediately after the label specified in the On Error statement.

i It should be reached by your macro only if an error occurs. This means that you must use a statement such as Exit Sub or Exit Function immediately before the label.

i It may require a Resume statement. If you choose not to abort the procedure when an error occurs, you must execute a Resume statement before returning to the main code.

0 0

Post a comment