Handle Errors
 
 
 

Most development environments provide default error handling. For VB and VBA, the default reaction to an error is to display an error message and terminate the application. While this behavior is adequate during the development phase of your application, it is not productive for your end user. There may be errors that you want to ignore, or that you want to provide special responses to. There may be errors that you will want to suppress the error message display for, or simply control the message that gets displayed to the user. In addition, automatically terminating the application is hardly ever acceptable to the end user.

In general, error handling is necessary whenever user input is required and whenever working with file I/O. Remember, even if you are sure a needed file is there and available for processing, there may be conditions you haven't thought of that could cause errors.

NoteMost of the code examples provided in the AutoCAD documentation do not use error trapping. This keeps the examples simple and to the point. However, as with all programming languages, proper error trapping and handling is essential for a robust application.