| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Sep 27, 2017
Main tips page | Browse tips
Enhancing the Find and Replace feature
Related pages -How to efficiently use "Find:" in the Find and Replace (F&R) dialog
REPLACEM - Replace multiple words in one pass (with macros)
DELCODES - Delete one or more types of format codes from a document in one pass
Often, the standard Find and Replace dialog has to be dragged from its position in the center of the screen if you want to see the item found or the item to be replaced.
Moreover, it does not provide an easy way to replace (or format) just certain instances of an item.
Finally, having to repeatedly open the F&R dialog (Edit, Find and Replace, or <Ctrl+F>) to find or replace the same item is tedious.
Here's a tip posted by Pam Britt on WordPerfect Universe that may help:
However, sometimes there is a problem with the part of Pam's tip that says -
Most of the time this will be true. But if the user has set Edit, Find and Replace, Action to "Position Before" or "Position After," or plays a macro that sets the Action to these values, then the items found will not be selected (i.e., "highlighted"). These items on the Action menu in Find and Replace are "sticky," so their settings will persist into the next session.
Here's a solution:
Create and play the Find and Replace.wcm macro below, which could be assigned to the <Ctrl+F> and/or <F2> key instead of simply the "Find and Replace" feature. It will reset the Find and Replace dialog's settings first; then it will pop up the Find and Replace dialog. This will be completely transparent to the user.
▸ To copy the macro code below into your own WordPerfect and create a functioning macro, see here.
▸ For help assigning macros to keystroke combinations ("shortcut keys") see here.
The two code snippets below in blue (by Klaus Pfeiffer at WordPerfect Universe) allow displaying the Find and Replace dialog at the top of the WordPerfect window to maximize visibility of the main text area. [Screen shot of dialog] You can adjust the horizontal offset from the center and the vertical offset from the top of the main WordPerfect window, in the SetWindowMostTop() command (i.e., the two numbers shown in bright red).
Note also that the AppLocate() command must have the exact name of your Find and Replace dialog (the macro assumes English editions of WordPerfect).
The two snippets in blue are optional, and can be deleted if desired. (The FindDlg() command is required if you want to display the F&R dialog.) The macro then will simply reset Find and Replace settings to factory defaults (using the Procedure) when it displays the F&R dialog.
Some Find and Replace dialog settings -- such as the Option to specify a Search inside headers, footers, footnotes, endnotes, text boxes, and other "substructures" -- are not amenable to being reset by a macro (no relevant commands exist). Hence, you should manually check the F&R dialog's menu and enable (or disable, as your needs dictate) the Option to "Include Headers...". However, in writing macros, search and replace command parameters (Regular! and Extended!) can be used to set (and reset) the type of search or replace operation, as needed.
// Find and
// Purpose: Enhances the use of the standard Find and Replace feature by ensuring that certain WordPerfect default settings for the F&R dialog are reset -- especially the "Select Match" option in the Action menu, which normally leaves the item selected (and thus more visible on screen) after it is found.
// Important Note:
// This macro sets various other
options for the standard Find and Replace feature in the Procedure at
the end of the macro code -- such as some settings that might have been
used during the session that you might want to have enabled (or
// For example, if you want to search inside selected material the Procedure below automatically disables "Limit Find Within Selection" by using the SearchInSelection (No!) command. Use Yes! in that command's parameter to search only in the selection.
// For convenience you can assign this macro to the <Ctrl+F> key and/or <F2> key to replace the standard methods of bringing up the Find and Replace dialog.
// Main macro code begins here:
// Open the Find and
Replace dialog at the top
SetWindowMostTop ("User32"; "SetWindowPos"; dword!;
// Exit from the macro:
// End of macro
When the found item is shown selected on screen you can use other standard formatting shortcut keys to quickly make the instance bold, italic, underlined etc. Just press <Ctrl+B> for bold, <Ctrl+I> for italic, etc., while the item is selected. Then simply press <Ctrl+Shft+F> to go to the next instance of the item, if desired.
You might even like to highlight the found-and-selected item (or any selected words) in the current highlight color.
[Alternative: If you want a macro that can highlight one or more words in any of several different highlight colors without using the F&R dialog, see HiLiteDoc here.]
Since there doesn't seem to be a built-in feature in WP's keyboard editor that you can directly assign to a shortcut key for this, use a macro instead. You can assign the small macro below to, for example, the <Ctrl+H> key to toggle highlighting on for the selected item.
To copy this macro into your own WordPerfect see here.
For help assigning macros to keystroke combinations ("shortcut keys") see here.
If you use the Redaction Tool in the initial release of WordPerfect X4, here are some tips (click here for the PDF version) when using normal highlighting (Tools, Highlight) in the same document that is marked up for redaction (Tools, Redaction).
Toggle.wcm - Toggle selected text to highlighted text.
Finally, note that redline or strikeout formatting (not to be confused with similar effects produced during a file Compare or Review) are not assigned to any standard shortcut key. However, they can be assigned to one using the "Attribute Redline" and "Attribute Strikeout" choices in the Format feature list, found in the keyboard editor's Keyboard Shortcuts window. Assigning them to <Alt+Ctrl+R> and <Alt+Ctrl+S> or other preferred keys might be handy. Since they do not require that the item be selected first, no macro such as Highlight Toggle above is needed.