Microsoft Office Tutorials and References
In Depth Information
The second type of watch is called a Quick Watch. When the macro is in break mode, highlight an
expression in your code and select Quick Watch from the Debug menu (or press Shift+F9). VBA
displays a box containing the current value of the expression as well as its data type and context.
Figure 21.11 shows a Quick Watch display.
Watches can also be used to control break mode. For example, you can specify that the macro
break either when a watch expression is True or when a watch expression changes value. You add
this type of watch using the Add Watch dialog box (see Figure 22.10), and is displayed in the
Watches window along with other watches. Type the expression in the Expression box of the
Add Watch dialog box, then select either the Break When Value Is True or Break When Value
Changes option. In the Watches window, the three types of watches — regular, break on true, and
break when changes — are displayed with different symbols in the left column. When a program
breaks based on a watch expression, the corresponding watch expression is highlighted in the
Displaying Quick Watch information about an expression.