Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
|Page updated Sep 2, 2009|
|Macro setup - a macro that formats any document with a custom "macro style"|
(This macro probably is most useful to macro writers.)
The macro sets up the current document with a custom (but user-modifiable) format for writing or editing macro code. See "How it works" below.
It can be played in a blank document or in an existing macro file (.WCM).
The technique might also be useful in storing ("hiding") formatting codes inside the document's initial [Open Style: DocumentStyle] code -- the first code you see in Reveal Codes at the very top of the document. See "Tips" below.
How it works
This macro formats the currently open document with
These are set up inside the document's initial style with the Styles Editor to "hide" them from casual editing.
It also displays the Macro Toolbar, then it inserts IfPlatforma/EndIfPlatform commands that bracket a programmer's comment area at the top of the page; this technique lets you insert initial comments without having to precede each comment with "//".
How to modify it
To edit the font, font size, tab setting or line number changes made to a document's body text area after the macro plays, use File>Document>Current Document Style -- not File>Document>Default Font, which will not override existing font or font size codes that are inside the Styles Editor (they are "downstream" from the Document Default Font dialog settings and therefore take precedence).
You can modify the default values in the redlined areas of the macro code. You can also remove the message that pops before the macro exits.
Some things cannot be created inside a style (with the Styles Editor), but it might be possible to create them in a document's body text area, then copy the codes to the Contents field of the Styles Editor. For example, it is possible to create a [Delay] code in a document, then cut (Ctrl+X) the code to the clipboard and paste (Ctrl+V) it into the document's Open Style.
Reset page margins on page 2 and following pages back to the default (or some other setting), and hide this process inside the initial document style. This can be done with a macro for the current document, or it can be done in a template such as a letterhead template.
Step 1. Put the cursor at the top of page 1, then click Format, Page, Delay Codes. Accept the "1" in the "Number of pages..." field and click OK.
Step 2. In the Define Delayed Codes window that appears, click Format, Margins (or click the Page Setup or Page Size button).
Step 4. Click Close to exit from the Define Delay Codes window. In Reveal Codes, you should see a [Delay] code on page 1. Normally you should move the cursor past this new code before beginning typing your text so as not to push the code to another page.
Step 5. "Hide" the the [Delay] code so it is less likely to be moved or deleted accidentally: Open Reveal Codes, select just the new [Delay] code, cut it to the clipboard with <Ctrl+X>. Then double-click the initial [Open Style: DocumentStyle] code at the top of the document; this opens the Style Editor; paste the [Delay Code] into the Contents field, then click OK. (Just remember to look inside the initial style code if you need to revise or delete the [Delay] code!)