Debugging Quattro Pro macros

Once you create a Quattro Pro macro, you can turn on the macro debugger to check for errors in the code. This allows you to

 
assign standard or conditional breakpoints
 
assign trace cells
 
assign cells for editing

You control when debug mode is active and turn it on or off as needed. You can play a macro while in debug mode. You can also edit Quattro Pro macro cells from the debugger.

If you know that most of a macro is correct, you can use breakpoints to play parts of a macro at full speed and step through other parts that may have problems. There are two types of breakpoint:

 
Standard breakpoints — pause the macro at the breakpoint cell
 
Conditional breakpoints — pause the macro when the result of a logical formula in the conditional breakpoint cell is true

You can set up to four conditional breakpoints for each notebook. Conditional breakpoints can be extremely valuable. Suppose you have a macro loop that contains date calculations and you want it to pause whenever December is reached. If the date is in cell A5, assign the first conditional breakpoint to a cell containing the following formula:

  MONTH(A5)=12   

As long as the formula in the condition cell is true (has a value of 1), the macro plays in step-by-step mode. Once the formula is false (has a value of 0), the macro stops playing.

You can set up to four standard breakpoints. Sometimes a problem appears after many repetitions of the same commands in a macro loop. If this is the case, you can set a pass count to indicate how many times to pass through the breakpoint before stopping. The default, 1, stops the macro every time it passes through the breakpoint. Setting it to 2 stops the macro every other pass.

Conditional breakpoints debug a macro using Boolean logic. The debugging process pauses only when a positive result (1) is returned by playing the script.

Macros often affect the contents of one or more cells. By tracing these cells, you can see what the macro is doing. You can specify up to four trace cells whose addresses and current values display during debugging in the debugger window. The debugger updates as the contents of the trace cells change.


To play a Quattro Pro macro in debug mode

Wordperfect Quattro Pro btnbacktotopproc Debugging Quattro Pro macros
1.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Debugger.
2.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Play.
3.
 
Enable the Quattro Pro macro option.
4.
 
Type the location of a macro in the Location box.
5.
 
Click in the debugger window to step through each macro command until you find an error.

You can also
Exit macro debug mode
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Debugger.
Stop macro before debugging is finished
Click Terminate.

Wordperfect Quattro Pro tip Debugging Quattro Pro macros

 
You can also play a macro in debug mode by pressing Shift + F2.

To set a standard breakpoint in a Quattro Pro macro

Wordperfect Quattro Pro  Debugging Quattro Pro macros ktotopproc.gif" alt="Back to Top" border="0" height="10" width="10">
1.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Debugger.
2.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Play.
3.
 
Enable the Quattro Pro macro option.
4.
 
Type the location of a macro in the Location box.
5.
 
Click OK.
6.
 
Click Breakpoints, and click a breakpoint to set.
7.
 
In the Breakpoint dialog box, type the breakpoint cell reference in the Location box.
8.
 
Type a value in the Pass count box.
9.
 
Click OK, and press the Spacebar.

You can also
Remove standard breakpoints
Type 0 in the Pass count box.
Clear all trace cells and breakpoints
Click Reset.

Wordperfect Quattro Pro tip Debugging Quattro Pro macros

 
You can also resume stepping through the macro by clicking Go.

To set a conditional breakpoint in a Quattro Pro macro

Wordperfect Quattro Pro btnbacktotopproc Debugging Quattro Pro macros
1.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Debugger.
2.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Play.
3.
 
Enable the Quattro Pro macro option.
4.
 
Type the location of a macro in the Location box.
5.
 
Click OK.
6.
 
Click Conditional, and click a conditional breakpoint.
7.
 
In the Conditional cell dialog box, type the cell reference in the Location box.
8.
 
Click OK.
9.
 
Press the SPACEBAR.

Wordperfect Quattro Pro  Debugging Quattro Pro macros .gif" height="15" width="16" border="0" hspace="0" vspace="0">

 
You can also resume stepping through the macro by clicking Go.

To set a trace cell for a Quattro Pro macro

Wordperfect Quattro Pro btnbacktotopproc Debugging Quattro Pro macros
1.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Debugger.
2.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Play.
3.
 
Enable the Quattro Pro macro option.
4.
 
Type the location of a macro in the Location box.
5.
 
Click OK.
6.
 
Click Trace, and click a trace cell.
7.
 
In the Trace cell dialog box, type the trace cell reference in the Location box.
8.
 
Click OK.

To edit macro cells from the macro debugger

Wordperfect Quattro Pro btnbacktotopproc Debugging Quattro Pro macros
1.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Debugger.
2.
 
Click Tools Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Macro Wordperfect Quattro Pro onestep Debugging Quattro Pro macros Play.
3.
 
Enable the Quattro Pro macro option.
4.
 
Type the location of a macro in the Location box.
5.
 
Click OK.
6.
 
Click Edit.
7.
 
In the Edit cell dialog box, type the edit cell reference in the Cells box.
8.
 
Edit the contents that display in the Content box.

Debugging Quattro Pro macros