Chapter 17

Debugging Your Code and Handling Errors

In this chapter, you’ll learn some of the things that can go wrong in your VBA code and what you can do about them. You’ll examine the types of errors that can occur, from simple typos to infinite loops to errors that occur only once in a while.

The chapter starts by explaining the principles of debugging. Then you’ll work with the tools that VBA offers for debugging VBA code and use them to get the bugs out of a few statements. The end of the chapter discusses the various methods of handling errors and when to use each one.

In this chapter you will learn to:

  • Understand the basic principles of debugging
  • Recognize the four different types of errors you’ll create
  • Employ VBA’s debugging tools

Get Mastering VBA for Microsoft Office 2007, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.