What if you want to monitor an expression throughout your entire program? Just
as you can set a single watch pertaining to an individual module, you can also
set a single watch that applies to an entire program.
To define a global watch, you once again can use either the Add Watch dialog
box or Edit Watch dialog box. First, select All Modules from the Module combo
box. (As with the Procedure combo box, the All selection is the first item in
the drop-down list.) This will also automatically set the Procedure watch to All
Procedures in the Procedure combo box. Figure 18.26 shows an example of this.
FIGURE 18.26 A global watch.
The Watch expression in Figure 18.26 will be evaluated in all procedures in
all modules as the program executes, making it global in scope.
As you set watches at various levels of scope, you will notice that the Watches
dialog box displays the context of each expression. As shown in Figure 18.27,
a procedure-level watch is indicated to apply to a particular procedure by the
ModuleName.ProcedureName syntax in the Context column of the Watches dialog box.
A module-level watch has the name of its module displayed in this column. A global
watch is indicated when the entry is blank, denoting that there is no contextual
limitation on the watch.
FIGURE 18.27. The Watches dialog box indicates the level of scope for each