The Wildcard Find & Replace Macro

The Wildcard Find and Replace (WFR) macro, found on the Other menu of EditTools, is designed to make it easy for an editor to use the powerful wildcard find and replace function of Microsoft Word. WFR is for both the editor who is experienced with wildcards and the editor who is new to wildcards.

The main screen of WFR is as shown below.

Begin by entering the Find criteria in the Find field. Up to 9 fields are available. Each Field is designed to contain a single Find element. For example, assume that the information we want to search and modify is that shown in this figure:

Assume that what we want to do is change, using the first entry as an example, the order from the current order of chrono-7α-format to 7α-chrono-format. We would make our entries in the Find and Replace fields like this:

We used 5 fields to define our Find criteria (green arrow) and then reordered the Find criteria in the Replace With fields (red arrow). The macro shows what the actual Find and Replace criteria are (purple arrow), which gives advanced users additional information. But we don’t know whether the criteria we entered will actually find what we want and if it does find what we want, change it to what we want. Thus the TEST Find & Replace Criteria button (orange arrow).

The Test F&R gives you a chance to make sure everything is as you want before letting the macro run over your complete document. Clicking Test F&R causes the macro to highlight the first instance of what the Find criteria will find and asks you if this is correct:

If you click yes, the macro then makes the change called for by the Replace criteria and asks if this is the change you intend. Note that all changes are with Tracking ON:

If you click yes, the macro will then do a WFR throughout your document and make the appropriate changes, as shown here:

The main dialog window is still open so at this juncture you would click Close.

Clicking close brings up a dialog box that gives you three choices, as shown here:

Choosing Undo All undoes all of the changes you just made to your document; choosing Close (No Save) ends the macro and you are not given a chance to save your WFR criteria. If you choose Save Criteria, the below dialog appears, giving you a chance to save your WFR criteria for a subsequent search.

This dialog gives you several options for saving the criteria. Above the buttons it shows you the current WFR file to which you can add the criteria by clicking Add to Current. If you want to save the criteria to an already existing file but that is not the file shown above the buttons, choose Load Existing File. Click Add to New File if you want to create a new file. Cancel simply cancels this task.

The dialog box gives you the opportunity to briefly describe what the WFR criteria do and to provide a more complete description, as shown here:

After entering the description, click the appropriate button. Doing so will raise this dialog box, confirming that the criteria have been saved:

The next time you want to use criteria that you have previously saved, in the main dialog box click Retrieve from WFR Dataset.

Clicking Retrieve from WFR Dataset opens the Dataset dialog box shown here:

Note in the dropdown (red arrow) the criteria appears using the short description. Click on it and then click Select (green arrow). That will cause your selected WFR criteria to populate the Find and Replace With fields in the main dialog window as shown here:

Now let's look at some of the other options in the WFR macro. If you click the Test button (assuming your Find and Replace With fields are populated) you will get the following dialog. This time, however, we’ll choose No as our response:

Choosing No cancels the test and the selected material is deselected and you are returned to the main dialog box so you can modify the criteria as needed.

If you choose Cancel on the main dialog box, you get the three choices shown below. The two relevant options are to Save Criteria or Close (No Save).

There are several ways to populate the fields. You can always manually enter criteria using your keyboard. Another way is to place your cursor in the field and right-click. That will bring up the following options:

Another option is to click the asterisk (*) button (red arrow in the figure below), which will bring up the dialog with the options indicated by the green arrow in the following figure:

As an example, if you click Number from the menu, the Number dialog box will appear. The default is no limit to the numbers that can be found, but if you want, for example, a minimum of 3 numbers but no more than 5 numbers (i.e., 350, 4554, or 56789, but not 1 or 23 or 567890+) you would enter 3 in the minimum field and 5 in the maximum field.

Assuming you left the fields blank and No Limit checked, clicking OK would enter the correct criterion in the first available field as shown here:

The Replace With fields offer the same options (manual entry; right click; asterisk button) but the options presented by the asterisk (*) button are different than those offered for the Find, as this figure shows:

If you click Find Criteria from the menu, it brings up the Use Find Criteria dialog box which lists the entries found in each of the populated Find fields. Double-clicking on the criterion you want to populate the first available Replace With field selects it, as shown below.

Click OK and that criterion is automatically placed in the first available Replace With field, as shown here:

If what you want in that field is not found in the Find criteria, you either manually, right click, or select a different option from the menu to place the criterion.

What About Symbols & Special Characters?

Searching for and replacing with symbols and special characters — whether by themselves or as part of a word or phrase — is easy with WFR. Right click in the appropriate field (Find: or Replace With:) and you will see a menu as shown below. The last option is Show Symbol Dialog.

You can choose one of the symbols in Word’s Symbol dialog. Double-click the symbol you want and it is placed in the appropriate field. Note that the menu lists some of the more commonly used symbols.

What About Advanced Users?

The most important features of WFR for advanced users are the capability to test the find and replace criteria and the ability to save and reuse wildcard searches, neither of which is available in Word.

845.471.3566