Locals Window

Sometimes it can be quite tedious to test the value of every variable when your code enters break mode. If you're stepping through code and need to test the value of seven different variables every step of the way, that's a lot of Debug.Print statements to keep track of in the Immediate window. You can use the Locals window to display all the variables in a procedure and their values. You can watch the variable values change as you step through the code. To display the Locals window, choose Locals Window from the View menu. Figure 5-7 shows the Locals window while stepping through the previous CoffeeTime procedure.

As you step through the procedure, the Locals window shows you the up-to-date values of all variables. Figure 5-8 shows the Locals window for the same procedure when you reach the last line of the procedure. Once you reach the end of the procedure and execution stops, the Locals window is empty again.

Was this article helpful?

0 0

Post a comment