Creating VBA macros

Quattro Pro lets you start Visual Basic for Applications (VBA) from Quattro Pro. You can display the VBA toolbar, which provides quick access to commands such as playing a macro or starting the VBA Editor.

With VBA, you can create a project macro. You can play a project macro only in the document which was used to create it.

You can create a project VBA macro by creating a public method for the ThisDocument object. The term public refers to the access level. If a method is public, it can be accessed from outside the class. This means that you can call it from the host application. If a method is private, then only methods in the same class can access it. Every public method that belongs to the ThisDocument class is a project macro.

You can copy PerfectScript to a VBA code module. You can also copy Quattro Pro macro script to a VBA code module.

You should always play a macro once you have created it. For more information about playing a PerfectScript macro see “To play a PerfectScript macro.”

For more information about VBA, see the Microsoft Visual Basic Help in the Visual Basic Editor.


To start VBA from Quattro Pro

Wordperfect Quattro Pro btnbacktotopproc Creating VBA macros
 
Click Tools Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Editor.

Wordperfect Quattro Pro note Creating VBA macros

 
For more information about VBA, see the Microsoft Visual Basic Help in the Visual Basic Editor.

To display the VBA toolbar

Wordperfect Quattro Pro btnbacktotopproc Creating VBA macros
1.
 
Click View Wordperfect Quattro Pro onestep Creating VBA macros Toolbars.
2.
 
Enable the Visual Basic check box in the Toolbar list.

Wordperfect Quattro Pro note Creating VBA macros

 
For more information about VBA, see the Microsoft Visual Basic Help in the Visual Basic Editor.

To create a VBA project macro in Quattro Pro

Wordperfect Quattro Pro btnbacktotopproc Creating VBA macros
1.
 
Click Tools Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Editor.
2.
 
In the Project explorer Docker window, double-click the VBAProject (NoteBk1) in the list of categories.
3.
 
Click Insert Wordperfect Quattro Pro onestep Creating VBA macros UserForm.
4.
 
In the Toolbox dialog box, drag any control to the user form.
5.
 
Modify any of the control’s attributes, in the Properties Docker window.
6.
 
Double-click a control.
7.
 
In the Notebk1 code module window, type the code that responds to the activation of the control.
8.
 
Open the QuattroPro objects folder in the Project explorer Docker window.
9.
 
Double-click ThisNotebook.
10In the Notebk1 code module window, type the code that adds a new method to the notebook.

To copy PerfectScript to a VBA code module

Wordperfect Quattro Pro btnbacktotopproc Creating VBA macros
1.
 
Open the .wcm file containing the PerfectScript macro.
2.
 
Select the macro.
3.
 
Click Edit Wordperfect Quattro Pro onestep Creating VBA macros Copy.
4.
 
Click Tools Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Editor.
5.
 
In the Project explorer Docker window, double-click VBAProject (NoteBk1) Wordperfect Quattro Pro onestep Creating VBA macros Quattro Pro objects Wordperfect Quattro Pro onestep Creating VBA macros ThisNotebook in the list of categories.
6.
 
In the Notebok1 code module window, type Public Sub and the name of the sub.
7.
 
Within the Public Sub, type Application.PerfectScript.
8.
 
Click Edit Wordperfect Quattro Pro onestep Creating VBA macros Paste.
9.
 
Replace the first brace from the line of code with a period.
10.
 
Choose the VBA code that is equivalent to the PerfectScript code from the list.
11.
 
Type End with at the end of all the code and within the Public Sub.

To copy Quattro Pro macros to a VBA code module

Wordperfect Quattro Pro btnbacktotopproc Creating VBA macros
1.
 
Open the file containing the Quattro Pro macro.
2.
 
Select the macro.
3.
 
Click Edit Wordperfect Quattro Pro onestep Creating VBA macros Copy.
4.
 
Click Tools Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Editor.
5.
 
In the Project explorer Docker window, double-click VBAProject (NoteBk1) Wordperfect Quattro Pro onestep Creating VBA macros Quattro Pro objects Wordperfect Quattro Pro onestep Creating VBA macros ThisNotebook in the list of categories.
6.
 
In the Notebok1 code module window, type Public Sub and the name of the sub.
7.
 
Within the Public Sub, type Application.PerfectScript.
8.
 
Click Edit Wordperfect Quattro Pro onestep Creating VBA macros Paste.
9.
 
Replace the first brace from the line of code with a period.
10.
 
Choose the VBA code that is equivalent to the Quattro Pro code from the list.
11.
 
Type End with at the end of your code and within the Public Sub.

To play a VBA macro

Wordperfect Quattro Pro btnbacktotopproc Creating VBA macros
1.
 
Click Tools Wordperfect Quattro Pro onestep Creating VBA macros Visual Basic Wordperfect Quattro Pro onestep Creating VBA macros Play.
2.
 
Choose VBAProject(NoteBk) from the Macros in list box.
3.
 
Choose a macro from the Macro name list box.
4.
 
Click Run.

Wordperfect Quattro Pro tip Creating VBA macros

You can also play a VBA macro by clicking the Play Wordperfect Quattro Pro pgx play Creating VBA macros button on the Visual Basic toolbar.

Creating VBA macros