Use a breakpoint to suspend running of Visual Basic code

Use a breakpoint to suspend running of Visual Basic code

When you suspend execution of Visual Basic code, the code is still running but is paused between running statements. While running of your code is suspended, you can do debugging tasks such as check current variable values and run each line of code one at a time. To make Microsoft Visual Basic pause running your code, you can set a breakpoint.

  1. In the Visual Basic Editor Code window, move the insertion point to a line of code that isn't already a breakpoint, or declaration.

  2. Click Toggle Breakpoint on the Debug toolbar.

To clear a breakpoint, move the insertion point to the line of code on which the breakpoint has been set, and then click Toggle Breakpoint on the Debug toolbar. To resume running the code, click Run Sub/UserForm on the Run menu.

Note   You can also cause code execution to be suspended by adding a Stop statement to a procedure or by pressing CTRL+BREAK while the code is running.