Chapter 17Debugging 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 (intermittent bugs are usually the hardest to locate).

The chapter starts by explaining the basics of debugging. Then you'll work with the debugging tools available in VBA and practice using these tools to get the bugs out of some examples. The chapter concludes with a discussion of various ways to have your program itself respond to errors that happen during runtime.

Get Mastering VBA for Microsoft Office 365, 2019th Edition 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.