Summary
The VBE in Excel 2007 provides us with many tools to debug our code. The better we get at
using these tools, the faster we can correct our code, and the more our productivity will
increase. In this chapter, we looked at the Debug menu and the Debug toolbar, and we
explored their commands.
The ability to step through code and move the execution point forward and backward are
invaluable assets when debugging code. The Immediate window provides us with an easy way
to run code and to view the values of in-scope variables. In this chapter, we explored these
CHAPTER 7 n DEBUGGING AND ERROR HANDLING 285
aspects of the Immediate window, and even how to run a loop from it. The Locals window provides
a great way to view all the variables and their values in one place. The Locals window
also shows us objects and their properties as we step through our code in break mode.
We also learned about setting breakpoints to stop our code to help us pinpoint issues.
We explored some concepts to apply before coding to help prevent errors, including the
Option Explicit command, which forces us to declare all variables before using them.
In the next chapter, we??™ll look at ways Excel can interact with other Microsoft Office
products like Word and PowerPoint.
CHAPTER 7 n DEBUGGING AND ERROR HANDLING 286
Office Integration
One of the really great things about VBA in Microsoft Office is that it allows programmatic
access to each application from the others. This powerful functionality lets us automate many
business processes, including data integration and document creation and management.
Pages:
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269