| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
|Page updated Sep 2, 2009|
|REPLSTYL - Replace one style with another, or remove a style's codes|
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.
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.)
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).
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.