Vba Part9
Vba Part9
Reset or Stop Stops execution of your code and clears objects out of memory.
The Navigational Tools: The tools are available on the Debug Toolbar (See figure 1) and on the Debug
Pulldown menu (See Figure 2).
o
Step Out (Ctrl + Shift + F8) Complete running the current sub or function only
Jan/Feb 2003
PaperSpace
p. 1
Run to Cursor (Ctrl + F8) Skip ahead to a line of code and click the left mouse button to mark
the location, then hit the hot key combination (Ctrl + F8) to advance to your marked location.
Watch Window Usage: Checking values during execution. A watch expression is an expression
you define to be monitored in the Watch window. When your application enters break mode, the
watch expressions you have selected previously appear in the Watch window where you can
observe their values. This is useful for global variables which cannot be seen in the locals
window, and Note: You can drag selected expressions from the Code window into the Watch
window while in break mode to see their values, but they must be in context or scope. There are
different types of watches as described below:
Jan/Feb 2003
Watch Expression This type of watch displays the watch expression (variable,
property, or Function) and its current value. When you enter break mode, the
value is automatically updated.
Break When Value Is True Execution automatically enters break mode when
the expression evaluates to true or is any nonzero value Note: This will not be a
valid choice for string expressions.
PaperSpace
p. 2
Break When Value Changes Execution automatically enters break mode when
the value of expression changes within the specified context (see below).
Watch Context: Sets the scope of the variables watched in the expression.
Procedure Displays the procedure name where the selected term resides
(default is where it is first used or declared). Also available is the list of
procedure(s) in which the expression is evaluated. You may select all procedures
or a specific procedure context in which to evaluate the variable. (Hint: if you
think the variable is being changed incorrectly, you can try to select available
procedures to identify and watch the value as the macro progresses.)
Module Displays the module name where the selected term resides. You may
select all modules or a specific module context in which to evaluate the variable.
Call Stack (Ctrl + L) Displays the Call Stack dialog box, which lists the procedures that have started but are not
completed. Note: This command is only available while in break mode. This really should be part of the
navigation tools since it points you to the subroutines or functions that call or follow the current code line, but it is
available from the locals window through choice of a button, by selection from the View menu pulldown as
shown in the graphic above, or by using the Hot Key combination (Ctrl + L).
How it works: When executing code in a sub or procedure or function, that procedure is added to a list
of active calls. Each time a procedure calls another procedure, it is added to the list. Called
procedures are removed from the list when execution returns to the calling procedure. Note: Procedures
called from the Immediate window are also added to the calls list.
Jan/Feb 2003
PaperSpace
p. 3
Jan/Feb 2003
PaperSpace
p. 4