"Ads by Goooooogle" links provided by Google.com, which has sole control over all advertising content it displays on this site.

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

Barry MacDonnell's
Toolbox for WordPerfect

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

Page updated Jan 11, 2008
REPLSTYL - Replace one style with another, or remove a style's codes

Download REPLSTYL.ZIP (v1.05; 01/11/08; 30,169 bytes)

Compatible with WordPerfect versions 8,9,10,11,12,X3

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

Downloading, Documentation, Modifications, and Support

This macro replaces a standard or custom (user-created) Paragraph or Character style wherever found in the document with another standard or custom Paragraph or Character style. [Custom styles must already be present in the document. For more on WordPerfect styles, see here.]

Menu options allow you to remove all instances of a style rather than replace them, and to pause for confirmation of each item processed.

Background:

WordPerfect allows you to globally change an existing style throughout a document by editing the style. Click on Format, Styles, and choose a style; then click Edit to bring up the Styles Editor. Or, you can simply double-click the style's code in Reveal Codes to bring up the Styles Editor. While in the Styles Editor, make your changes, then be sure to check "Automatically update style when changed in document" so that later changes can be made globally throughout the document either in the Styles Editor or by merely applying a formatting change (such as a special color, etc.) to any instance of that style in the main document window.

However, it may be more desirable or more convenient -- and probably faster -- to replace one style with another style (usually of the same type) everywhere in the document, which is the main purpose of this macro. The macro also lets you remove the style (but not the text to which the style was applied) by deleting the style's codes. You can choose to either of these in one operation, or have the macro pause for confirmation at each style's location. (To change outline styles, see the note below.)

Important notes:

  • This macro does NOT work with Document (open) styles, which do not have paired codes (open styles have only a beginning code, which means the style remains in effect until it is changed). It only works with Paragraph and Character styles, which have a beginning and ending code surrounding their text.
    • To determine if the two styles to be used by this macro are either Paragraph or Character styles, double-click each style's code (if available) in the document's Reveal Codes window and look under 'Type' in the Styles Editor that pops up. Alternatively, use Format, Styles to display the Styles Editor, where the styles should be listed; choose the style and click Edit to determine the style's Type.
  • On the main menu, be sure to enter any custom (i.e., user-created) style's name EXACTLY (including upper/lower case) as it appears in the Style drop list on the property bar for this document. Style names can be up to 20 characters long according tor WP's online Help.
  • If you choose "Prompt for confirmation," the macro will obviously run more slowly. To help you see which style is currently being processed when the macro pauses for confirmation, open Reveal Codes before playing the macro.
  • If you are trying to replace a paragraph outline (e.g., Para Style: Level 1) with another paragraph outline (e.g., Para Style: Legal 1), try using the more direct approach of clicking Insert, Outline/Bullets... (or double-click the [Outline] code above the outline items) and choosing the new outline from the Bullets & Numbering dialog. You probably don't need to use this macro for such a purpose.
    • In fact, since a WP outline is really a combination of a paragraph number and a "level" style (click Edit in the Bullets & Numbering dialog and you'll see the link between paragraph numbers and specific styles at each outline level), using REPLSTYL to replace one outline with another will perform only half the task by replacing just the style portion of the outlines. You would still need to reset the numbering for each paragraph level, too. [To do this, double-click the [Outline] code above the outlined material and when the Bullets & Numbering dialog opens, select the new outline's name and click OK. This will reset the numbers for the outline that is present in the document.]
  • It is always a good idea to test any macro's operation and results on a copy of your document.

Tips:

It is possible to swap two styles using the three-step "ABC" method: To swap style "A" with style "B," first create a temporary style "C" -- perhaps a simple style (Character or Paragraph, depending on style A's type) created with little or no formatting, using a QuickStyle. The temporary style is used to move style A out of the way temporarily. Then use this macro to replace A with C (i.e., A becomes C), then replace B with A (i.e., B becomes A), then replace C with B (i.e., C -- which was A -- becomes B).

Schematically: A => C, B => A, C => B.

When finished, you may want to delete the temporary style from the document with Format, Styles, (choose the style), then click Options, Delete.

It might be helpful to use a QuickStyle (style C) that is readily identifiable (such as a redlined or highlighted style) to help identify where you are in the three-step process. For example, place the cursor on a redlined word in the document, and select "QuickStyle" from the Select Style drop list on the text property bar. Give the QuickStyle a name, choose Paragraph or Character, and click OK. Use this temporary style as style C in the ABC method.