Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
Page updated Oct 20, 2020
Main tips page | Browse tips
A primer on
Some resources -
Getting the most out of Reveal Codes in WordPerfect. A short Corel Tutorial by Laura Acklen.
Cracking the Codes in WordPerfect 11. (Even though written for WordPerfect 11 it still remains useful for later versions.)
Reveal Codes list (in PDF format). (Download location of a compiled list by a WordPerfect Universe moderator.) Some newer codes are not listed, but the document should still be very useful.
[New for WordPerfect X8/X9/2020:] The Corel site has a PDF titled "WordPerfect Office Reveal Codes Chart" on their download page here.
[See Tips and Tricks below]
Reveal Codes is a WordPerfect on-screen feature that lets you "look behind the scenes" for specific details about your document's formatting — and even let you change current formatting or correct formatting mistakes quickly and easily.
Most long-time WordPerfect users, especially those who have also used other products, would probably tell you it is one of the most important reasons — if not the main reason — they use WordPerfect.
With WordPerfect, items responsible for formatting (as well as for objects like graphic boxes and tables) are visible as small, labeled format codes in the Reveal Codes pane when it is open adjacent to the main document area.
This pane (or "window") — which has been called a "second editing screen" since it has its own red insertion cursor — can be toggled open and closed with Alt+F3 or with View, Reveal Codes.
As you move the cursor around in the document the pane is updated to display the area — both text and codes — around the cursor's position.
The codes can help tell you what is happening at any given point. One author (see Acklen in the sidebar) suggests that even new users can greatly benefit by observing how and when codes are inserted in the document's steam of text. This helps them better understand how formatting is accomplished in WordPerfect, which can help them modify that formatting, remove unwanted formatting, or untangle format problems.
And if that wasn't helpful enough, double clicking directly on a code in Reveal Codes brings up a separate editor dialog (e.g., for a style it's the Styles Editor) which lets you reconfigure the code's formatting — and it will instantly apply your changes wherever that code appears in the dociument.
Other word processors (e.g., Microsoft Word) use a different technique, which results in hiding the items actually responsibile for formatting.
Once you learn the usefulness of Reveal Codes you'll probably never want to be without it.
Tips and tricks
☼ Open or close Reveal Codes with Alt+F3, or use View, Reveal Codes
Normally the current state of Reveal Codes — open ("on") or closed ("off") — is retained between sessions.*
Alternative: You can also click on a small (unnamed) bar at the very bottom of the program's vertical scroll bar, just under the Next Page button. Hover your cursor on it and it changes to a two-headed arrow. Click it and the Reveal Codes window should toggle on or off. If dragged up or down, the same button can expand or shrink the window (or use the next tip below).
New with WordPerfect X8: The "small (unnamed) bar" is now a button:
Tip: If you prefer Reveal Codes to always be open (or closed) whenever you launch WordPerfect you can use a small macro that is triggered by the startup switch /m.
The macro would contain one of these commands:
RevealCodes (On!) - or -
To create the macro see here; then see the information on using startup switches (read the first paragraphs and then look under "/m" in the table).
* Some early program versions did not retain the Reveal Codes state between sessions (e.g., early builds of WordPerfect X5), so be sure your program is patched with the latest Service Pack or Hot Patch, available on the Corel site's Support page.
☼ Expand or shrink the Reveal Codes window
When Reveal Codes is open you can place your mouse cursor on the divider between the main document area and the Reveal Codes pane, and then left-click on the divider and drag it to a new position.
See "To customize the display of Reveal Codes" below for some more tips.
☼ Moving around in — and with — Reveal Codes
With Reveal Codes open you can click inside it to position the red block insertion cursor █ (representing the actual insertion point in the main document window) just as you can position the cursor in the main document window.
This insertion cursor should also move in lock-step with the one in the main document: move one with mouse or keys and you move the other.
You can move the insertion cursor with your keyboard's arrow (◄ ►) keys, too. (In fact, Shift+arrow is a very handy, more precise way to select individual codes and/or characters in Reveal Codes to copy (Ctrl+c) or cut (Ctrl+x) them.)
¤ When you use the keyboard to move the cursor with Reveal Codes open, the cursor will treat many format codes as though they are characters and thus it will require extra keystrokes to move the cursor beyond them. (Macro writers make use of this to detect specific codes.) Even with Reveal Codes closed, it can sometimes take an extra keystroke or two to move the cursor (e.g., moving past a cell boundary in a table). This sometimes alarms users: they may think that something is wrong with the keyboard. Open Reveal Codes to see what is happening at that location.
¤ There's a small downside here, so be a little careful. It can be easier to accidentally delete format codes when Reveal Codes is open. See "Deleting..." below, especially about restoring an accidental deletion.
☼ Finding (most) codes in your document with Find and Replace
The Edit, Find and Replace dialog has both a Match, Codes and a Replace, Codes option for the Find and Replace fields respectively. (You might have to scroll down the lists to find some codes.)
Codes can be inserted into those fields using the appropriate option. Alternatively they can be carefully selected in the document itself (via Reveal Codes), then copied and pasted into those fields.
Note that Find and Replace cannot find codes inside certain other codes, such as those inside [Style] codes or [Delay] codes, as noted below.
See WordPerfect's Help <F1> for more information. Also see the tips here.
☼ Show more information about codes in the Reveal Codes window
• Use your arrow keys to place your insertion cursor — it will appear as a red vertical bar or "box" like this █ — in front of (i.e., to the left side of) a code to see more information about that code (if more is available).
- Or -
• Hovering your mouse cursor briefly on top of a code (then moving it slightly if necessary) will show the information.
- Or -
• You can also set the program to always display more detail for many of the codes in Reveal Codes, as noted in a tip below.
Tip: There are some additional references on the Internet about the meaning of WordPerfect format codes: See the left sidebar.
☼ Codes in the "stream"
Metaphorically speaking, WordPerfect "reads" these codes (as well as text characters and other materia)l from left to right — right being "downstream" from any codes and other material located to the left or above.
This process begins with the basic formatting passed on to the document from the template that spawned it, and with any other special formatting that might be contained in the document's initial [Open Style: DocumentStyle] code (for more on this code see the next tip below and also here).
Then it reads and follows the format "instructions" inside any other format codes you (or the program) placed in the document.
From the Toolbox's Templates page:
"The main thing to keep in mind here is that, unlike some other word processors, WordPerfect is a "stream oriented" program, where format codes take effect until they are either discontinued (i.e., stopped or suppressed by user intervention) or replaced by another code of the same type (e.g., a new text color).
Hence, new formatting applied in the document is downstream from previous formatting and upstream from other (potential changes in) formatting.
It is the way we type (or dictate, or assemble) material into a document: There is a stream of information with a beginning and end. Occasionally we give the computer an instruction to change the appearance of something in the stream — like hitting the Caps Lock key to emphasize letters as we type them. Format codes do the same thing.
Note especially that single format codes can be inserted into the stream of text and they will affect subsequent, downstream text; or, if you select text first, they will bracket the selection with a pair of codes — one to start the formatting and one to stop it — and the formatting will apply to just that selection (and superseding other codes of that type).
This simple "stream" metaphor can help you produce complex or creative formatting — sometimes with things beyond what other word processors allow — but it can also help solve many format problems, too."
In summary, the program's basic formatting scheme works like this:
Template file (default and user-specified format codes — e.g., preferred font, margins, etc. — and any other material such as images or small amounts of boilerplate text in the template)
Document file's [Open Style: DocumentStyle] initial code
Tips for intermediate users
• For documents containing changes in formatting that are
▸ assembled manually (e.g., with Insert, File or with copy-and-paste),
▸ assembled using the Subdocument feature (see some tips here), or
▸ part of a multi-page merge (see here),
you might want to be sure to explicitly set each document's basic format — or in the case of merging, your merge form's basic format and pagination codes — at the top of each assembled document or at the top of the merge form document (.frm).
This should be done in the body text area of the inserted material (for merges, it just needs to be in the merge form) so that the formatting change carries "downstream" into the target document until it is replaced or discontinued by other existing format codes of the same type (if any). For the general method see here.
• Most format codes are placed at, or adjacent to, the current cursor location, such as when you apply the bold attribute to a selected word or phrase.
But WordPerfect automatically places some codes where they most logically should go, such as the top of the current paragraph or page. [To suspend this feature see Footnote 2.] So you might want to scroll up to the top of the paragraph — or even to the top of the page — to see if there are codes that might be impacting the formatting at the current cursor location.
• Inserting (or deleting) material above format codes in the document can cause some codes to move downward (or upward).
In most cases this is not a problem but sometimes this can be disconcerting if some items — such as graphic images or text boxes, margin reset settings, formatting Delay codes, etc. — seems to be misplaced after such editing. [See for example, "Attaching graphic images..." here for some solutions relating to graphics or text boxes.]
The primary solution is to use Reveal Codes to see if misplaced single codes can be relocated (see "Copying, relocating..." below). If not, you can always delete them or temporarily relocate them to another document (e.g., a new blank document) and reformat the relevant section of the current document.
☼ The importance of the first (i.e., beginning) code at the top of a WordPerfect document
Templates in WordPerfect set up a special, initial style code in new documemts that acts as a "container" to pass various design elements "downstream" to the new documents when they are created.
This initial style code, [Open Style: DocumentStyle], is visible at the very top of the new document in Reveal Codes, and it will remain present for as long as the document exists. (It cannot normally be deleted; however, if it is not present, see here.)
Essentially this code is the vehicle that transports whatever other styles or format elements you wish to pass on to the downstream text in new documents based on that template. Typically these include a default document font and font size, and default margin settings — any of which you can modify or supplement (for more see here).
☼ Types of codes: single, paired, and hidden
As noted above, format codes can be single (a.k.a. "document" or "open") or paired (such as used with certain style codes). The former remain in effect until replaced by another style code (if any). The latter apply to selected text or to paragraphs. [See the Styles page for more information.]
Codes can even be hidden inside certain other codes — e.g., inside a [Style] code, such as inside the initial style code discussed above, or inside a [Delay] code, as discussed in the next tips.
Generally, you can double-click on a format code in Reveal Codes to open its Styles Editor to make changes to it. (See "Modifying a code" below.)
Tips and notes about Delay codes
Sometimes manual formatting — or even some automatic formatting — causes the program to insert a [Delay] code in the document, usually to delay the onset of certain formatting by one or more pages.
This might be deliberate on your part, such as to delay a margin change until the next page. (To manually insert a [Delay] code, use Format, Page, Delay Codes.) Or it can be automatic, if the program thinks the onset of certain formatting should be delayed a page (or more).
These [Delay] codes also act like little containers for other format codes, and as such they can hide the codes that might be causing a format problem. You can double-click on the [Delay] code to view what is inside it.
Delay codes are actually made up of two codes:
The first [Delay] code tells WordPerfect what to do; the second [Delay Codes] code appears on the (delayed) page and tells WordPerfect where to start doing it.
Double-click on the first code of the pair to open the Define Delay Codes window (this name is displayed at the very top of the WordPerfect main window). It should show the codes inside it in the Reveal Codes window.
(Note also the special toolbar that should be displayed (e.g., see the Delay codes page here), which lets you (a) insert an image, (b) set the page size, or (c) insert a header, footer and/or watermark. These buttons open yet another window inside the Define Delayed Codes window, so you will need to close each in reverse order to return to your document.)
☼ Deleting, restoring, or replacing codes
• Deleting a SINGLE code can be done directly in the Reveal Codes window.
click directly inside the Reveal Codes window to position your cursor next to the code and then use either the <Delete> or <Backspace> key, depending on which side of the code the cursor is on.
click-and-drag the code from the Reveal Codes window.
¤ There are a few exceptions to these methods.
▸ You cannot manually delete the initial [Open style] code at the top of a document (discussed above).
▸ You cannot delete "soft" format codes (e.g., [SRt-SPg]). They are added by WordPerfect as placeholders for normal "hard" codes (e.g., a [HRt] or a [HPg]) in case you add or delete something above them, in which case the program will automatically restore the needed hard code versions at those locations.
▸ You cannot delete some codes when Reveal Codes is closed.
A note this caution from the "Cracking the codes..." book in the sidebar above:
"... When the Reveal Codes window is NOT displayed, WordPerfect skips most codes when you press the Delete or Backspace keys so that you don't delete codes by accident. When the codes are revealed, however, WordPerfect figures that you can see what you are doing, and when you press Delete, it deletes the code to the right of the red cursor.
Save your document (press Ctrl+S) before you make any changes in codes because it's easy to make a horrendous mess with this code stuff. If you save your document before you goof up, you can just close the messy version (press Ctrl+F4) and reopen the original (press Ctrl+O) to start fresh.
Your trusty friend Undo (Ctrl+Z) works when you make changes to Reveal Codes as well."
See also -
"Moving around ... in Reveal Codes" above, and
"Should you keep Reveal Codes open all the time?" below.
¤ Remember that some codes can be hidden inside other codes:
See above — especially about [Delay] codes. Such codes act as little containers so deleting the container deletes any and all codes inside it.
Hence it's generally better to open the [Delay] code (see above) and inspect its contents for codes you want to delete; you can then delete just the specific code you want to remove.
• Deleting PAIRED codes is similar to deleting SINGLE codes (above).
However, with paired codes, deleting either the first code or the last code of the pair will immediately delete the other code in that pair.
(Remember that paired codes can be separated by quite a lot of text or other material — even other codes — so you might want to identify both parts of the pair before deleting either one of its codes to be sure you want to remove them.)
• Delete ALL codes in the document:
▸ Method A: (Deletes all codes)
Simply use File, Save As and choose (under File Type on that dialog) ANSI Windows Text. Then close the document and re-open it. All formatting codes should be gone, leaving just plain text characters.
▸ Method B: (Deletes all codes or just the codes in selected text)
If you want to strip out all format codes from the current document — or just from a current selection of material — to produce "pure text," first copy the document's contents (Edit, Select All) or the currently selected text, to the Windows clipboard (Edit, Copy ... or just use Ctrl+C); then immediately paste the copied text back in place with Edit, Paste Special, Unformatted text.
Newer versions of WordPerfect have this Paste Unformatted Text choice on the context menu that pops up with a right-click of your mouse.
This method does not require you to save, close, and then re-open the document — which can be handy to quickly remove codes from smaller sections of text, or unwanted codes that were brought into the document from outside sources (such as some codes from MSWord documents). It also converts some format codes to their plain-text counterparts (e.g., outline entry numbers become plain, non-incrementing text numbers).
▸ A note of caution and some tips:
Be aware that deleting format codes — if applied globally to the entire document — can remove or change some format codes you might wish to retain, such as headers, footers, footnotes, endnotes, overstrike codes, (some) symbols, hidden text, delay codes, and (in WordPerfect 11 and later versions) they change hard spaces to soft spaces, regular hyphens to hard hyphens, and remove soft hyphens.
This is where careful human editing can become important. (For more details on Edit, Paste Special, Unformatted Text see here.)
Still, they can be a useful techniques, especially to convert (selected) outlines and numbered or bulleted lists to their plain-text versions, remove unwanted codes brought in when copying/pasting from another program or the Internet, etc.
Lastly, don't forget that you can remove many WordPerfect codes and symbols by saving the document in Rich Text Format (RTF) with File, Save As. This is a "cross-platform" document format that most other software (including Microsoft Word) can read, and it retains most common formatting (bold, italics, etc.). It is still a viable format that's included in WordPerfect's File Type field in both the File, Save and File, Save As dialogs. [If you are curious about it see the Wikipedia article for more information.]
• Delete just SOME codes WHEREVER they appear in the document:
See the DelCodes macros which let you specify the types of code to delete. Then the macros search the document and delete the desired codes.
• You can usually RESTORE a deleted code during the WordPerfect session with either Edit, Undo or with <Ctrl+Z>. This is best done immediately after deleting it since subsequent deletions are also stored in Edit, Undo/Redo History.
• How to REPLACE format codes with plain text "markers":
See the Code2Txt macro. For example, you can change [Bold]text[Bold] to <B>text</B> or similar.
• How to REPLACE or AUGMENT specified format codes with other format codes:
You can download and use the free Replace Codes macro, which can -
- replace specified codes wherever found in the current document with other codes (e.g., replace underlines with italics).
- augment (add) specified codes (e.g., change bold text to bold italicized text);
- delete specified codes (see also DelCodes, which contains 3 macros);
- change an applied text attribute (e.g., bold) to a more complex character style code for convenient use (and easy modifications later).
• How to REPLACE one specified [Style] code in the document with another [Style] code of your choice, or (optionally) remove the specified style: See the ReplStyle macro.
☼ Modifying a code
You can double click on a code in Reveal Codes to bring up the same dialog box that (probably) was used to create the code at that location.
When you make changes to the code and return to the document's editing screen, WordPerfect updates the code there. [Or, in the case of some codes — such as certain automatically updating Paragraph Style codes — it can immediately update all instances of the code in the document.]
☼ Copying, relocating (moving), or reusing codes in other documents
With Reveal Codes open you can select single formatting codes (with or without adjacent text or other material); then you can copy the selection to the Windows clipboard with <Ctrl+C>, and then paste (Ctrl+V) the material into another location — or even into another document.
For example, you could select/copy/paste the code that defines a custom watermark for use in another document.
Again, note that this applies to single codes, not paired codes. (See above for more on single and paired codes.)
▸ To select just the code(s) it might help to use <Shift+arrow>, which can be a bit easier and more precise.
▸ To move a code to another location or document you can cut it with <Ctrl+X> instead of copying it before pasting it elsewhere.
▸ To reuse ("repurpose") a code somewhere else in the future, you can turn the selected code into a QuickWord, which is stored in its own special program file. Note that this is probably worthwhile mainly for complex format codes (e.g., headers, footers, watermarks, tab sets, custom table codes, custom styles, etc.), since it is usually easier — and sometimes more reliable — to apply new formatting directly into the document you are working on.
☼ Should you keep Reveal Codes open all the time?
The basic answer is that it's a matter of personal preference whether it's open ("on") or closed ("off") — at least while editing a document. But for macro operations see the note just below.
Many people. including this author, prefer to keep it open during editing so they can quickly check on formatting if necessary. And it can be very helpful when deleting, copying, or cutting material in preventing format problems that might occur in such circumstances if you inadvertently remove some codes that can affect other, usually adjacent, material.
You can always quickly toggle it open/closed with <Alt+F3>. (Also, you can force it to your preference automatically with a macro when the program is launched, as discussed above.)
¤ See "Deleting or replacing a code" above for some cautions when Reveal Codes is open.
¤ On the other hand, a good reason to keep Reveal Codes open is that some macros that move the cursor item by item (i.e., move past both individual characters and/or format codes) assume that Reveal Codes is open during the macro's execution. If a macro doesn't seem to work properly, try opening Reveal Codes. In fact, macro writers probably should always add code to their macros to temporarily open Reveal Codes whenever the cursor is required to move item by item during macro operation. See Footnote 1 below for some code snippets to do this.
☼ Microsoft Word users (and WordPerfect newbies):
Tips on applying fonts and other formatting to a WordPerfect document — see here about single codes, paired codes, the "WordPerfect stream," and other topics.
☼ Other tips [from WordPerfect X6's Help Topics:]
• To customize the display of Reveal Codes -
1. Click Tools > Settings.
2. Click Display.
3. Click the Reveal Codes tab.
4. In the Format area, enable or disable any of the following check boxes:
• Wrap lines at window — to continue codes on the next line
• Show spaces as bullets — to display a bullet for each space character
• Show codes in detail — to display formatting information with codes
• Auto-display codes in Go to dialog — to display the Reveal Codes window when a code match is found in a specific section of the document
You can also
- Change the font: Click Font, and choose a font from the Face list box.
- Change the font size: Choose a font size from the Size list box.
- Change the font color: In the Color area, disable the Use system colors check box. Open the Text color flyout, and click a color.
- Change the background color: In the Color area, disable the Use system colors check box. Open the Background color flyout, and click a color.
- Use Windows system colors: In the Color area, enable the Use system colors check box.
• To print the codes in a document -
[N.B.: This feature is not present in WordPerfect 10 and earlier versions.]
1. Click File > Print.
2. Click the Advanced tab.
3. In the Advanced options area, enable the Print Reveal Codes check box.
Note: When you print codes in a document the printed document does not contain any information other than the codes and the text. For example, graphics (shown in Reveal Codes as a [Box] code) and file information are not printed.
• For descriptions of format codes see the resources in the left sidebar.
[...Continued from "Should you keep Reveal Codes open all the time?" above...]
More about setting (and resetting) the current state of Reveal Codes in a macro
• Background and simple solutions
Many macros need to have Reveal Codes open during macro execution. For example, if a macro must find, skip over, or delete format codes, or determine the position the cursor relative to a code, Reveal Codes must be open.
A very simple way to do this in the macro's code is to use something like the following code [or something like Kenneth's code in this post or Jim Shackleford's post]. It turns Reveal Codes on if it is not already on, then resets the original state of Reveal Codes (on or off) as it exits.
[See also an alternative using the WP51CursorMovement command below.]
// Put this 4-line segment at the top of the
// macro code (after any Application command):
vRevCodeState = ?RevealCodesActive // Store the current state of RC...
If (Not ?RevealCodesActive) // If RC is not open...
RevealCodes (On!) // ...open the RC window
// ...Main part of macro goes here...
// Put this segment at the end of the macro and
// wherever else the macro might exit:
If (Not vRevCodeState)
• Problems with Reveal Codes in some versions of WordPerfect for Windows
However, in past years I have found some complications.
1. Reveal Codes cannot be turned on in some early versions of WordPerfect (e.g., WP9) if the View menu choice is set to, say, "Two Page." Thus, macros which might be used in any WordPerfect version should first turn Page View on before turning Reveal Codes on; later, before it terminates, it should automatically reset the View (technically, the "display mode") to what it was before the macro started.
2. A macro cannot set the View if the cursor is located inside a "substructure" — that is, if it is inside a header, footer, footnote, endnote, text box, etc. (This is true even if you try to use the View menu manually.) Thus, the macro should exit from any substructure first before adjusting the View and turning Reveal Codes on, and then return to the previous cursor location inside the substructure.
Below is a macro that can do both things.
• A macro solution that can be used with all versions of WordPerfect for Windows
The following code deals with the above issues when the code sets Reveal Codes "on" (if it was not already on) and then, before the macro terminates, when it resets Reveal Codes to the state it was in before the macro was played. In other words, it restores the user's current setting to what it was before the macro was played.
[To copy this code into your WordPerfect program to create a working macro, see here. Note that this example macro will simply display a message, but you can use the rest of the code in any macro to set (i.e., open) and then reset Reveal Codes.]
// Reveal Codes Toggle.wcm by Barry MacDonnell.
// Lines beginning with double slash marks (//) are
// comments and can be deleted.
// Blue comments are your "how to" instructions.
// STEP 1
// Put this Call() command at the top of the macro or
// where the macro begins its processing:
// STEP 2
// Main macro routines go here:
// Simple example:
Messagebox(;;"Reveal Codes = On and View = Page")
// STEP 3
// Macro exits here:
// Put this Call() command at any place where the macro
// might exit; it restores RC to the original state (On or
// Off) and also restores the original View (i.e., Display)
Return // (or use Quit)
// STEP 4
// Put the entire section below at the end of the macro (after
// the exit command such as Return or Quit) along with any
// other called routines, functions, or other procedures:
// (This segment is called from the top of a macro:)
// [Checks to see whether Reveal Codes is on; it should be on
// while the macro plays and the View should be set to Page.]
// First, if inside a substructure, mark the current location and
// then exit from the substructure(s):
pExitSubstructures () // <- Calls the Procedure() below
// Then get the current View (Draft, Page, Two pages, etc.):
// Set the View to Page mode ("2"=Draft; "3"=Page; note that in
// some WP versions the Command syntax's help file shows "4"
// for Two Page View, even though it is really "5"):
If(?DisplayMode <> 3) ViewPage Endif
// Get the current state of Reveal Codes:
// Turn Reveal Codes on if it is not already on:
If(Not ?RevealCodesActive) RevealCodes(On!) Endif
// Go back to original cursor location; delete temporary bookmark:
// (This segment is called at any point where the macro exits:)
// Reset the state of Reveal Codes and user's View setting:
If (Not vRevCodeState) RevealCodes(Off!) EndIf
// Then, if inside a substructure, mark current location,
// then exit from the substructure(s):
pExitSubstructures () // <- Calls the Procedure() below
// Reset user's display mode (see View menu):
// (Note: Web Page view in WP8/9: Since there is no 'ViewWebPage'
// macro command in WP8/9, get the user's WP version number and
// restore the view to Page)
If((vDispMode=1 and vWP<=8) or (vDispMode=4 and vWP=9))
If(vDispMode=2) ViewDraft Endif
If(vDispMode=3) ViewPage Endif
If((vDispMode=4 and vWP<=8) or (vDispMode=5 and vWP>8))
// Go back to the original cursor location; delete temporary bookmark:
// Exit from any header, footer, footnote, endnote, text box, etc.:
Procedure pExitSubstructures ()
If ((vSubDoc=10) or (vSubDoc=11))
// If cursor is inside an image or a text box is selected, exit from it:
If (vBoxType=1 or vBoxType=3) BoxEnd (Save!) Endif
// *** End of code ***
The last Procedure — i.e., pExitSubstructures() — is very helpful in many other macros whenever forcing an exit from a substructure is required. It can be called as often as needed in a macro.
• Alternative to the macro solutions above
See the macro commands, WP51CursorMovement(On!) and WP51CursorMovement(Off!). For many macros these can work well.
WP51CursorMovement(On!) is usually placed at the top of the macro and WP51CursorMovement(Off!) is placed wherever the macro can exit.
Macro writers who might want more detailed information can view Noal Melltott's test of this command on WordPerfect Universe here. Also from Noal:
"To its disadvantage, WP51CursorMovement(On!) does not do away with the message about confirming deletions [set via Tools, Settings, Environment, Prompts tab] as does turning RevealCodes on. Furthermore, when on, it keeps some macro commands, such as PosLineVeryEnd(), from moving beyond any attribute code at the end of the line!" [Emphasis added.]
Hence, the Reveal Codes Toggle macro snippet above may be more generally reliable. But the decision rests on exactly what the macro is designed to do.
[...Continued from above...]
If WordPerfect automatically places some codes at the top of a page or at the top of a paragraph because of its automatic code placement feature, you can stop (suspend) this from happening with a simple one-line macro, then start (resume) it again with another similar macro.
Note that this method of using an "off switch" will turn the auto-placement feature OFF for the current document (and all other open documents) for the current session. (It does not affect placement of codes already in the document(s).)
So you might want to create both macros and assign them to separate toolbar buttons or keyboard shortcuts (see here for help with this).
Note that you must use macros to use this feature: There are no settings for it in a menu.
[To copy this macro code into your WordPerfect program to create a working macro, see here.]
Macro #1 should contain this command (to turn automatic code placement OFF):
When you play that macro it won't put any visible code in the document to indicate that auto code placement is turned OFF -- although some codes that normally would be auto-placed might show "Ignore:" in the code in Reveal Codes.
Note that this macro's command is a global setting for the current WordPerfect session -- i.e., it "switches off" auto code placement immediately for all open documents, but only for new formatting that normally responds to that feature and only while the OFF setting is active. When you close and re-open WordPerfect auto code placement returns to its ON state.
Macro #2 should contain this command (to restore automatic code placement to ON):
So that you don't forget to do it, it might be a good idea to play this second macro as soon as you finish formatting the document with your desired "stay-in-place" codes. Otherwise, the current and other documents that are open or will be opened during the same WordPerfect session will not have the auto code placement feature turned ON, which is the usually desirable state.
Note also that turning auto code placement ON again (with Macro #2 or any other macro with this command) in a document after it was turned OFF (with Macro #1 or any other macro with this command) will not revert any "stay-in-place" code placements to their usual auto code placement postions. It affects only code placements going forward in the current (and future) sessions.
[Thanks go to CyndyZ for this tip on WordPerfect Universe here.)