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 240 | Next

Jim DeMarco

"Pro Excel 2007 VBA"


Once you??™re in break mode, the break line text (the code at the breakpoint) and the execution
line text (the currently executing line of code as you step through) are highlighted. The
default highlight color is maroon for the break line text and yellow for the currently executing
line of text. This color coding is user-definable on the Tools ?¤ Options menu on the Editor
Format tab, as shown in Figure 7-18.
At the first breakpoint, you will get a combination of the break and execution line colors.
CHAPTER 7 n DEBUGGING AND ERROR HANDLING 263
Figure 7-17. VBE enters break mode when a breakpoint is reached.
Figure 7-18. Options dialog box showing VBE color options
5. The Step Into command moves you through your code one line at a time. Press the F8
key (or choose Debug ?¤ Step Into) to move to the first line of code inside the loop. The
color coding should now be more easily seen, as in Figure 7-19.
CHAPTER 7 n DEBUGGING AND ERROR HANDLING 264
Figure 7-19. Better view of the break and execution lines of code
6. Press the F8 key twice to move the execution line to the ExternalProcess routine.
7. Press F8 again to move the execution line into the ExternalProcess procedure.
As you can see, the Step Into command moves you through the code one line at time.
When it encounters another procedure call, it moves you into that procedure. At the moment,
our execution point is inside the ExternalProcess subroutine. To move out of this procedure
without moving line by line, use the Step Out command by choosing Debug ?¤ Step Out or by
pressing Ctrl+Shift+F8.


Pages:
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252