Using Debugging Tools and Break Mode

You work with modules when you write a macro (design time) and when you run it (run time). This chapter introduces a third state for modules — when execution is suspended. This is called break mode. In this state, the code is running but is suspended between executing statements. In break mode, you can use the debugging tools to examine your code.

Four buttons on the Visual Basic toolbar provide shortcuts to commands you use when debugging your code. The following illustration shows this part of the toolbar.

The following table briefly describes the function of each button. The following sections in this chapter explain how each of these buttons can help you debug or analyze code more efficiently.

Debugging button

Function

Toggle Breakpoint

Creates or removes a breakpoint. A breakpoint is a location in the code where Visual Basic halts execution.

Instant Watch

Displays the current value of an expression while the code is in break mode.

Step Into

Runs only the next executable line of code. If the code calls another procedure, your view into the code shifts to the called procedure until it ends.

Step Over

Runs the next executable line of code. If the code calls another procedure, runs the entire procedure without shifting your view of the code to the called procedure.