Using macro conventions and formatting macros

When you create macros in WordPerfect, you must follow macro conventions for the macro to compile properly. However, you do not need to observe macro formatting conventions for a macro to compile correctly. These conventions are designed to improve the readability of your macro.


Macro conventions

Macro command syntax must be correct for a macro to compile. Understanding the following conventions used in WordPerfect macros will help you avoid common syntax errors:

You can enter programming commands in uppercase, lowercase, or mixed case. The compiler is not case sensitive. Product commands, such as AboutDlg or AddSlide, are shown in mixed case. WordPerfect system variables begin with ?, such as ?TextColorRed or ?FontUnderline. They are shown in mixed case, and they return information about the application environment.

Line wrapping does not affect macro execution. You should not insert spaces in a command name unless the space is part of the syntax. Do not use hard returns, tabs, or indents in a character expression (a character string enclosed in double quotation marks). You can use spaces, tabs, indents, and hard returns before and after commands, or between parameters, to make a macro easier to read. SmartQuotes in a macro create a compile-time syntax error. For more information about SmartQuotes, see “Changing the appearance of quotation marks.”“Changing the appearance of quotation marks” in the online Help.


Formatting macros

You can type commands into a macro that is saved in a file or in a template. If you want to improve the readability of a macro, you can format it so that it includes tabs, spaces, and even font or text appearance changes. Formatting the macro does not affect how it works. For example, WordPerfect records the following macro in this format:

  PosDocBottom()   Type(Text:"Sincerely")   HardReturn()   HardReturn()   HardReturn()   HardReturn()   Type(text:"Mrs. Jane Doe")   HardReturn()   Type(Text:"Vice President, Marketing")   

However, if you type the commands yourself or edit an existing macro, you can format the macro the way you want. For example, you can format it as follows:

  PosDocBottom()      Type(Text:"Sincerely")      HardReturn()   HardReturn()   HardReturn()   HardReturn()      Type(text:"Mrs. Jane Doe")      HardReturn()   Type(Text:"Vice President, Marketing")   

Using macro conventions and formatting macros