Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

ERROR HANDLING

Whenever your program interacts with the outside world, you should provide some form of error handling to counteract unexpected inputs or outputs. One way of providing error handling is to write your own error-handling routines.

Error-handling routines are the traffic control for your program. Such routines can handle any kind of programming or human-generated errors you can think of. They should not only identify the error, but try to fix it—or at least give the program or interacting human a chance to do so.

To begin error handling in a procedure, use the On Error GoTo statement to signify that you are going to use an error-handling routine:

On Error GoTo ErrorHandler

This statement can go anywhere in your procedure, but should be placed toward the top, generally right after any procedure-level variable declarations.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial