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

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2017 by Barry MacDonnell. All Rights Reserved.

Page updated Jun 27, 2015

Colorize Text - A macro that finds all user-specified text in the document and colors it with any one of several standard colors or a custom color

Download COLORTXT.ZIP (v1.01; 06/13/06; 20,782 bytes )

Compatible with WordPerfect 8 and later versions

Downloading, Documentation, Modifications, and Support


ColorTxt.wcm is a macro finds specified words or short phrases and adds color to them.

This is done in a similar manner to Format, Font, Color -- but it works on all the specified words or phrases that are found in the document.

It may be particularly useful in long letters or reports to add color emplasis to certain words or phrases.

When you play the macro a menu appears.

ColorTxt macro's menu

Simply input the desired word or (short) phrase to color. Then choose a color. Several standard colors are available, or you can use a color wheel or RGB color values to select a custom color. (See the Tip below about RGB values.)

You can play the macro more than once on the same document, using different colors for different text.

Menu options include adding bold and/or italics to the item(s) and to pause for confirmation of each instance found. You can also remove existing colors before adding new ones.

Note that applying a "red color" as used here is not the same as Redline (i.e., a red appearance applied with Format, Font, Redline, or the red color created with WordPerfect's Document Compare/Review). Colorizing text with this macro uses color codes to bracket the text, the same as if you used Fomrat, Font, Color to apply a color.

You can undo changes (Edit, Undo) after printing or viewing. However, it is always best to work on a copy of the document or save it with a different name after applying the color.

A menu option allows removing all (or specific) instances of color.


  • RGB ("Red/Green/Blue") numerical values for custom colors can be obtained by passing your mouse slowly over the small color squares in Format, Font, Color. The three numbers correspond to the Red/Green/Blue components of the color.
  • You can quickly delete all color codes (as well as many other WordPerfect format codes) in the document with DelCodes. The DelCodes macro is especially useful to simultaneously remove both color and bold/italics from certain sections of th document. For smaller sections of selected text, you can copy (Ctrl+C) the selection to the clipboard, then immediately paste it back into the original selection area with Ctrl+Shift+V or with Edit, Paste Special, Unformatted text (here is a macro to do this).
  • If you want to quickly highlight text in various colors in the same document, see the HiLite suite.
  • To color an individual selection of text (or an individual word) using a keyboard shortcut, you will need a separate, simple macro. For example, copy this code into your WordPerfect (see here for help) to create a working macro, then assign it to an available keyboard shortcut. It will color the word(s) in blue (but you can change the RGB value (see first tip above):
    • If (NOT ?BlockActive)
          SelectWord  // (if nothing else was selected, select the word)
      TextColor (Red: 0; Green: 0; Blue: 255)
      PosBlockBottom // (optional)

Known limitations

  • Once you apply more than one color to text in the same document, you can remove all color codes at once with a menu choice (you could also do this manually with Find and Replace, Match, Codes, Color), or you can remove these items one at a time by choosing the Pause option. (Incidentally, be sure "Whole Word" is set 'off' in Find and Replace if you decide to use the manual method.)
    • WordPerfect cannot search for a specific color's code, just a universal [Color] code -- of which there are both single-code and paired-code varieties. (Actually, it is possible to do this but it would complicate the macro's program code.)
    • So you can't select, say, just items with blue colors and delete that color only from the text. (Sorry.) However, as mentioned, the macro has an option to pause and ask for confirmation during the color removal process. This lets you choose to remove a particular color or a particular instance of the same color, by processing the document one item at a time.
  • Words hyphenated with normal soft [- Hyphen] codes will not be found, which seems to be a limitation of the WordPerfect macro language. If you replace all such codes first with hard hyphens, the macro will find "hyphenated" words. (Start at the top. Click on Edit, Find and Replace, then with the cursor in the "Find" field, click Match, Codes, "-Hyphen", Insert, Close. Repeat for the "Replace with" field, but insert "-Hyphen Character".)
  • The macro language cannot store text strings longer than 64 characters in a variable. This is the reason for the character limit in the text input field on the main menu.

Page Top