Runtime Errors

As the name suggests, a runtime error is an error that occurs when an application is running. They are distinct from bugs, which are errors in program logic. (Dealing with bugs will be covered in Chapter 21.) Often, the cause of a runtime error is something you have no control over. You cannot prevent the error, but your code can deal with it, or handle it, as programmers typically say. What happens if your code does not handle errors? Then, VBA will use the default error handling mechanism, which is to display a message identifying the error and then terminate the program. This is definitely a bad thing! When a program terminates unexpectedly, there can be all sorts of negative consequences ranging from the serious problem of ...

Get Office® XP Development with VBA now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.