More WORD Tricks

 

by Don Mankowski

 

I find that superfluous spaces within a document are a common complaint amongst editors. They're likely to remain invisible and undetected for long stretches, then spring to life to ruin the margins once some reformatting is done to the work.

 

You can remove all extra spaces in a passage or a document with a single command: it just takes creative use of the Find & Replace. This is probably somewhere in the printed MS WORD manuals, but you can get to an electronic version.

 

Just select Help from your main WORD screen. Either find it on the toolbar, press [Alt] and [H], or just press [F1].

 

If you have the (annoying) "Office Assistant," type the word "wildcard" in the animated noodle's text box and click [Search].

 

If instead, you've blown Office Bob away long ago, you'll get the standard "help" database. In this case, expand (click on the little plus sign) Editing and Sorting Text. Next, expand Finding and Replacing Text.

 

Now, we're on the same page, with or without Office Bob. From here select (double-click) "Find and replace text or formatting."

 

Click on the hyperlink Fine-tune a search by using wildcard characters.

 

Click on the hyperlink Type a wildcard character.

 

The screen that results is a WORD treasure! Maximize this screen and study it. Better yet, click on the picture of the printer and save a hardcopy if you can. (I keep a copy at my terminal all the time.) Following the advice on this screen enables you to replace just about anything with just about anything else in any of your documents.

 

To reduce any multiple spaces in a document to a single space, we have but to do the following. Select whatever text it is that you want to perform the work upon, all of it if need be. Then . . .

 

(1) Edit | Replace (i.e., select Edit, then Replace from the Edit menu. [Alt]+[E], then [E] will get you here as well, as will [Ctrl]+[H].

 

(2) Click on [More] if you must, to get the full range of Replace options. You must check the Use Wildcards box to get this trick to work.

 

(3) In the "Find what:" box, type the following: A space, a left brace, a 1 (one), a comma, and a right brace. The braces are the curly version of parentheses, found on the up-shift of the square brackets on most keyboards. Again, that's a space followed by {1,}. This tells WORD to replace from one to however-many of the character that precedes the left brace.

 

(4) In the "Replace with:" box, just type one space.

 

(5) Now, click [Replace All], and that should do it. Answer any questions you might be asked appropriately.

 

(If a subsequent search doesn't perform as expected, you may need to un-check the Use Wildcards box.)

 

The file spaces.doc that I've provided is a good one to practice on. (You can look at it with the see-all option toggled on (click the button with the paragraph mark on it) to readily see just how many spaces are on each line.)

 

This was a highly specific case, but you could have used any character, not just a space, in the search string, and anything at all in the replacement string. The expression inside the braces can be any single number, or two numbers denoting a range. By using 1 and nothing separated by a comma, we specified a range of one to infinity. In reading WORD's Help, one might think that the ampersand would work in this context, but it doesn't.

 

Still, who wants to remember such an exotic command string? Why not package the whole process within a macro, one which you can call when you need it? To reinforce last month's lesson, let's put this into a word macro.

 

Start WORD.

 

Load the file spaces.doc.

 

Select some or all of the text in the file.

 

Start the macro recorder. Tools | Macro | Record New Macro. Ignore the tiny pop-up window for now.

 

Now, perform the action. (Try to do it without any false starts or backtracking! Not fatal, just messy.)

 

In the "Macro name:" box, enter OneSpaceMax (or a better name, if you have one), and click [OK].

 

Select Edit | Replace. Select [More] if necessary.

 

Check the "Use wildcards" box if you have to.

 

In "Find what:" enter space, left brace, 1 (one), comma, right brace.

 

In "Replace with:" enter a space.

 

Select [Replace All].

 

Say [No] to the question, and [Close] the Find-&-Replace window.

 

In the tiny popped-up window, click the square "stop" button.

 

That's it! You can use Tools | Macro | Macros and select OneSpaceMax anytime to remove extra spaces from any selected text. Load the spaces.doc file again and try it out.

 

I really don't think that this trick is in-demand enough to warrant being assigned to a keyboard sequence or a menu line, but you might disagree. I'll explain how to do this in a future lesson.

 

You can improve this macro by editing it, as I explained in the closing paragraph in last month's essay, Creating Macros In MS WORD. Basically, you use Tools | Macro | Macros, highlight OneSpaceMax and select [Edit]. Then change .Wrap = wdFindAsk to .Wrap = wdFindStop. Finally, File | Save Normal and then and File | Close and Return to Microsoft Word. Now, when you run the macro, it will not halt to report its progress and prompt you.

 

Also see Creating Macros in MS Word

 

 © 2002 by Don Mankowski

Website

 

 

BACK