Step Into
Stepping
is the process of running one statement at a time. After
stepping through a statement, you can see its effect in the other Debugging
windows.
To step through code one statement at a time, choose Step Into from the Debug menu (F8), or press the button
When stepping intoa procedure, Visual Basic executes the
current statement and then enters Break mode (see above). You can now edit any
code and use the debugging tools. If the statement executed calls another procedure,
Visual Basic will step into that procedure. Once you have stepped through all
the statements in that procedure, Visual Basic will jump back to the next statement
of the procedure it was called from. To go onto the the next statement, press
the Step Into (F8) button again. If you press the play button (F5) code execution
will continue as normal.
Step Over
Step Over is the same as Step Into, except that when it reaches a call for another procedure, it will not step into the procedure. The procedure will run, and you will be brought to the next statement in the current procedure.
To step through code one statement at a time, choose Step Into from the Debug menu (SHIFT+F8), or press the button.
For example, if you had the following code:
Sub GetData()
Dim gName As String
gName = InputBox("Enter your name")
SetData(gName)
End Sub
Sub SetData(gName As String)
Text1 = "Name: " & gName
End Sub
Both Step Into and Step Over would behave the same, until they reached SetData(gName)
. Using Step Over, Visual Basic would run the SetData procedure, and
the cursor would be moved to the next statement in that procedure (in this case,
End Sub). Using Step Into, the cursor would be moved to the beginning of the
SetData procedure
Step Out
If you are using Step Into and have been moved to a called procedure, you can automattically run the current procedure, and return to the procedure it was called from by pressing the Step Out (Ctrl+SHIFT+F8) on the Debug menu, or pressing the button.
Comments