Stepping Through Code

There are two ways to begin the process of stepping through the code of a Sub procedure:

• Select the name of the procedure in the Macro Name list box and press the Step Into button. This will display the code module containing the procedure; the first line of the procedure will be highlighted in yellow, as in Figure 2-22).

• Add a breakpoint as described in the following section, then run the Sub procedure in the usual way.

When the code window is displayed, with a line of code highlighted, you can step through the code by pressing F8 or by using the Step Into toolbutton ^. The Step Into toolbutton is on the Debug toolbar; choose Toolbars from the View menu and Debug from the submenu to display the Debug toolbar (Figure 2-23).

The highlighted line of code is the statement to be executed next.

Debug

m

M

» Si ■

^ Ï-J Çi fs

Figure 2-23. The VBA Debug toolbar.

Figure 2-23. The VBA Debug toolbar.

0 0

Post a comment

  • Receive news updates via email from this site