SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 230 | Next

Jim DeMarco

"Pro Excel 2007 VBA"


Continued
CHAPTER 7 n DEBUGGING AND ERROR HANDLING 251
Table 7-2. Continued
Debug Toolbar Button Command Shortcut Key Description
Locals Window ??” Displays the Locals window. The Locals
window displays all of the variables in the
current procedure and their values.
Immediate Window Ctrl+G Displays the Immediate window. The
Immediate window allows you to type or paste
code and press Enter to run it.
Watch Window ??” Displays the Watch window. The Watch window
is where you define expressions to be
monitored (in the Watch window).
Call Stack Ctrl+L Displays the Call Stack dialog box. The Call
Stack dialog box lists procedures that have
started but have not finished, in the order they
were called.
CHAPTER 7 n DEBUGGING AND ERROR HANDLING 252
So there we have the tools we??™ll use to search out errors in our code. Before we begin putting
these to work and seeing what they can do for us, though, let??™s take a very quick look at
one line of code that the VBE will add for you that can help eliminate some coding errors from
the start: Option Explicit.
Option Explicit
The default installation of any Microsoft Office product and the VBE do not require variable
declaration before use. VBA will create the variable automatically the first time it is used. If you
include a call to Option Explicit at the top of your code modules, VBA will require that each
variable be declared before use.
nTip Why go to the trouble? Option Explicit helps the compiler catch any variable names you may
have mistyped.


Pages:
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242