Code in a subroutine or function can be stepped through during execution to help identify problems and evaluate branching within the code.
The execution of a subroutine or function can be paused at its declaration line, or by placing a breakpoint on the line of code that execution should be paused. Once execution has been paused, you can then step through and evaluate the results of each line of code one at a time. Normal execution can be restored when you are done evaluating the lines of code.
In the following steps, you learn to step through the gardenpath macro with the Step Into feature.
The VBA IDE is opened and execution of the gardenpath macro is paused. You will know it is paused because the declaration line Public Sub gardenpath() is highlighted.
The code statement gpuser is now highlighted.
Execution moves to the declaration line of the gpuser subroutine. The code statement Private Sub gpuser() is highlighted.
Notice that the highlight disappears and no new code is presented. This is because the GetPoint method is waiting for the user to enter a point in AutoCAD.
You see the prompt you specified in the GetPoint method at the Command prompt.
Focus is returned to the VBA IDE and the code statement sp(0) = varRet(0) is highlighted.
The Locals window is displayed. All the local variables and their values are displayed in the Locals window while the macro is executing.