Set break points in your VBScript code
Set break points in your VBScript code to indicate where run-time execution should be suspended.
As you develop your code, you will identify important sections where you want to focus your attention while debugging. For example, if your code includes a critical function that updates the values of several project tags, then you may want to suspend execution at the beginning of that function and observe the value changes as they happen. That is where you should set a break point.
A break point is a signal that tells the debugger to temporarily suspend execution of your project. When execution is suspended at a break point, your project is said to be in break mode. Entering break mode does not stop or end the execution of your project; execution can be resumed at any time.
You can think of break mode as being like a time-out. All the elements remain (functions, variables, and objects remain in memory, for example), but their movements and activities are suspended. During break mode, you can examine the elements’ positions and states to look for violations or bugs. You can also make adjustments to the project while in break mode; for example, you can change the value of a variable.
Break points provide a powerful tool that enables you to suspend execution where and when you need to. Rather than stepping through your code line by line, you can allow your project to run until it hits a break point, and then start to debug. This speeds up the debugging process. Without this ability, it would be almost impossible to debug a large project.
To set one or more break points in your VBScript code:
- Open the VBScript worksheet that you want to debug. The worksheet must be in one of the VBScript interfaces that supports debugging. For more information, see Debugging VBScript. The worksheet is opened for editing.
Figure 1. Example of a VBScript interface
- In the worksheet, find the line of code where you want to set a break point.
Tip: To show/hide line numbers in the VBScript interface, select Line Number on the View tab of the ribbon. The option is set independently for each worksheet; there is no global setting.
- Do one of the following:
- Click in the light blue gutter to the left of that line; or
- Click in the line to place your cursor, and then click Break Point on the ribbon.
A red break point symbol is inserted. If a break point cannot be inserted exactly where you clicked — for example, if it is a Dim statement that does not actually change any values — then it will be automatically inserted at the next possible line.
Figure 2. Setting a break point
- Repeat these steps for each break point that you want to set.
- Save and close all open VBScript worksheets.