Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Toolbox image Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2021 by Barry MacDonnell. All Rights Reserved.
Page updated Sep 2, 2009

Replace items with an expanded QuickWord

Download ReplWithQW.zip (v1.0; 10/11/06; 11,298 bytes)

Compatible with WordPerfect 8 and later versions

WordPerfect 11 users: See important information about using macros in the first release of WP11 ( at the top of this page.

Downloading, Documentation, Modifications, and Support

What about using EXPNDALL?

You can expand all QuickWord abbreviations throughout a document with the shipping macro EXPNDALL.WCM.

However, EXPNDALL only works if the QuickWord abbreviations are individual items and not part of a word; that is, the QuickWord abbreviation must be separated from other text characters. Still, this is a quick way to replace, for example, a text character or number (or a symbol) with a highly formatted item -- such as a math symbol in a different font and size, or a specially formatted corporate or product name -- that you have previously created as a QuickWord.


This macro offers a quick way to find certain items in a document and replace all of them with (for example) math symbols in a different font and size, custom formatted product names, large blocks of text, WordPerfect tables, graphics, words to which styles have been applied ... any "boilerplate" items where QuickWords might be a particularly useful tool. (See QuickWords for more information about how to use this handy feature.)

To put it briefly, ReplWithQW can find any existing character, word, phrase, or symbol wherever it appears in a document and replace it with an expanded QuickWord -- all in one step!

Note: Since QuickWords are stored in their own special template, they will be available in all documents for the same version of WordPerfect on the same system. See Managing and troubleshooting your QuickWords for information on migrating your QuickWords to another version of WordPerfect or to another computer.

See also the Notes section below.


Suppose you have created WordPerfect QuickWords that include text phrases with counters, such as described on the Counters page, something like this:

Interrogatory No. 1.
Did you ever ....

Interrogatory No. 2.
List the people within Division who ...

Interrogatory No. 3.
State where the manager told ....

Production Request No. 1.
Produce all records in the ...

Interrogatory No. 4.
Do you claim that Mr. X never ...

Production Request No. 2.
If your answer is Yes ...

... and so forth.

Instead of typing the QuickWord's abbreviations (e.g., "\Interog" and "\ProdReq") for each label as you produce the document, you could type simple, short, and unique placeholders such as "I>" and "P>". Then when you have finished the final draft, simply play the macro and replace each placeholder with the appropriate expanded and formatted QuickWord, such as Interrogatory No. 1.

This trick might be particularly useful if you got the document from someone else and it did not contain the desired styled labels or counters, just ordinary characters or words. All you would need to do is use the macro to replace the characters or words with your own expanded QuickWords -- which can contain styles, fonts and other formatting, text strings, symbols, and counters.

How it works

  • The macro first asks the user for a character, a symbol, or word(s) to find in the current document. This might be a character or symbol that was deliberately used during document creation as a "placeholder" that would be replaced later by other material. Of course, this can be done with Find and Replace; however, replacements are limited to 79 characters/symbols, and you might want to use highly formatted replacements again in the future (and if different documents).
  • Next, the macro asks for a previously created QuickWord abbreviation to use as a replacement for that specific character/symbol/word wherever it exists in the document.
  • The macro then -
    • finds the specified character/symbol/word;
    • optionally asks you to confirm the replacement (or Quit);
    • replaces it with the QuickWord abbreviation;
    • immediately expands the abbreviation; and then
    • continues to the next item until all items are found and replaced with the expanded QuickWord. (A tally is displayed at the end of its operations.)


  • The QuickWord must already have been created and stored in the user's QuickWords template, which is generally named QWnnxx.WPT (where nn = WP version and xx = language code). Otherwise, the macro will simply display a message that "0 items were replaced."
  • You must have the "Expand QuickWords when you type them" box enabled in Tools, QuickWords. The macro will set this option for you, then display a message and ask for your preferred default. (You probably also want the Options button in QuickWords to be set to "Expand as text with Formatting.") You can delete the redlined code below to remove this message.
  • QuickWords are more reliable if, when you create the QuickWord, you precede the QuickWord abbreviation with a character (such as a backslash) that is not likely to be found adjacent to the abbreviation's letters in any document. For example: \Addr, \Company, etc. [If you use the author's PickList macro, don't use a leading tilde (~) or caret (^), since those characters have a special meaning in PickList.]
  • Normally, to expand a QuickWord you need to follow the QuickWord abbreviation with a <space>, <Tab>, or press <Enter>. However, this macro does not need such a step since the macro language provides a command to insert and expand in one step.