The Debug Window


The Debug window allows you to set a watch on specific variables or properties to see what values they hold as your program executes. This will aid you in debugging by allowing you to analyze a variable or property that has an incorrect value and determine where the problem is coming from.

You can set the Debug window, as shown in Figure 7-3, by using Debug Add Watch from the menu.


Figure 7-3: Adding a watch on a variable

You enter the variable or expression that you wish to monitor in the Expression box. For example, if you have a variable x and you wish to keep track of the value of it, you enter x into the box. The context details are entered automatically, although they can be amended. You can also specify whether you want the code to break when the value of the variable is True (nonzero) or when the value changes.

Click OK, and the Debug window will appear with details of your variable in it, as shown in Figure 7-4.


Figure 7-4: Monitoring the value of a variable from within a watch window

When the program reaches a breakpoint, the value in the Debug window is updated. As you step through, it will also be updated. You can delete a watch expression by highlighting the expression, clicking it, and then pressing the Delete key.

You can also edit the watch expression by right-clicking the selected expression and selecting Edit.




Excel VBA Macro Programming
Excel VBA Macro Programming
ISBN: 0072231440
EAN: 2147483647
Year: 2004
Pages: 141

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net