Finding and Replacing Text Automatically


Any time you find yourself about to embark on a time-consuming hunt through a long document for a word or phrase, or for certain formatting, see whether Word's Find and Replace features can do the work for you.

Finding Text

If you frequently type long documents, you have probably had the experience of scrolling through each page trying to find all of the places where you used a particular word or phrase. Word can help you with this process, searching for text much more quickly and accurately than we humans can. Follow these steps:

  1. Choose Edit, Find (or press Ctrl+F ) to display the Find tab of the Find and Replace dialog box (see Figure 12.6).

    Figure 12.6. Use the Find tab of the Find and Replace dialog box to search for text.

    graphics/12fig06.jpg

  2. Type the text that you want to find in the Find What text box.

  3. Click the Find Next button. Word highlights the first occurrence of the word.

  4. Continue to click the Find Next button to look for more matches.

  5. Click OK when Word informs you that it has found all the matches.

  6. Click the Cancel button in the Find and Replace dialog box to return to editing your document.

If you want to be more specific about what text you're looking for, click the More button to expand the dialog box and display more options (see Figure 12.7). To collapse the dialog box again, click the Less button.

Figure 12.7. Click the More button to expand the dialog box, and the Less button to collapse it.

graphics/12fig07.jpg

By default, Word searches the entire document for the Find What text, starting from the location of the insertion point down to the end of the document and then from the top of the document back down to the insertion point. If you only want to search up or down from the location of the insertion point, change the option in the Search list from All to Up or Down. (You can also select text first to search only within the selected text.) The five check boxes that appear when you click the More button work as described here:

  • Match Case Mark this check box if you want to find only occurrences of the word that have the same combination of upper-and lowercase letters that you typed in the Find What box.

  • Find Whole Words Only Use this option if you don't want Word to find the search text when it's part of another word. For example, you'd mark this check box if you wanted to find only the word cat , not catch, decathlon , or scathing .

  • Use Wildcards Mark this option if you want to use wildcard characters in the Find What text. You can enter wildcards by typing them directly or by clicking the Special button and choosing them from a list. (To learn more about wildcards, look up information on Find and Replace in Word's help system.)

  • Sounds Like This option finds words that sound like the text you're searching for; use it if you're not sure of the spelling.

  • Find All Word Forms Use this option to find all forms of the word. For example, if you search for sing , Word also finds sings, sang, sung , and singing .

Replacing Text

Sometimes you not only need to find text, but you also have to replace it with something else. Word's Replace feature takes the tedium out of making the same change in several places.

Follow these steps to search for text and replace it with something else:

  1. Choose Edit, Replace (or press Ctrl+H ) to display the Replace tab of the Find and Replace dialog box (see Figure 12.8).

    Figure 12.8. Use the Replace tab of the Find and Replace dialog box to search for and replace text.

    graphics/12fig08.jpg

  2. Type the text that you want to find in the Find What text box.

  3. In the Replace With text box, type the text that you want to replace the Find What text. If you like, you can customize your find and replace operation by clicking the More button and then using the options in the expanded version of the Find and Replace dialog box (refer to Figure 12.7).

  4. Click the Find Next button.

  5. Word highlights the first occurrence of the word. To replace it, click the Replace button.

  6. To skip this instance without making the change, click the Find Next button.

  7. Continue this process. If you don't need to confirm every replacement, click the Replace All button.

  8. Click OK when Word informs you that it has found all the matches.

  9. Click the Close button in the Find and Replace dialog box.

If you change your mind about a replace operation after completing it, you can click the Undo button in the Standard toolbar to undo the replacements one by one if you used the Replace button, or all at once if you used the Replace All button.

Finding and Replacing Formatting

You can use Find and Replace as a quick way to search for and replace formatting in your document.

To modify formatting with Find and Replace, follow these steps:

  1. Display the Replace tab of the Find and Replace dialog box, and click in the Find What text box. (If the dialog box isn't already expanded, click the More button.)

  2. Click the Format button, and click the command that leads to the formatting option you want to search for. For example, if you want to search for boldface, click the Font command.

  3. Select the desired formatting option in the dialog box that appears, and click OK .

  4. The formatting is now listed beneath the Find What box.

  5. Click in the Replace With text box and use the Format button to specify the formatting that you want to replace the Find What formatting (see Figure 12.9). If you want to strip off the Find What formatting without replacing it, choose the default formatting. For example, to remove boldface, you would choose Not Bold in the Font Style list in the Font dialog box.

    Figure 12.9. Use the Format button to select the formatting to find and replace.

    graphics/12fig09.jpg

  6. Continue with the usual replace procedure.

To remove formatting from the Find What or Replace With text boxes when you perform future find and replace operations, click in the appropriate text box and click the No Formatting button.

graphics/lightbulb_icon.gif

If you like, you can combine formatting and text in the Find and Replace dialog box. For example, you could type the words Puget Sound in the Find What text box and then type Puget Sound in the Replace With text box and specify a single underline. This would search for and underline every instance of Puget Sound in your document.


Finding and Replacing Special Characters

In addition to finding and replacing regular text and formatting, you can also work with special characters. This enables you to do such things as search for manual page breaks and fields, remove extra blank lines, and so on. As you'll see, Word uses a code that consists of the caret symbol (^) followed by a single letter to represent each special character. For example, the code for a paragraph mark is ^p. Fortunately, you don't have to memorize theseyou can simply select the special characters from a list.

Follow these steps to search for and replace special characters:

  1. Display the Replace tab of the Find and Replace dialog box, and click in the Find What text box. If the dialog box isn't already expanded, click the More button.

  2. Click the Special button to display a list of special characters, and click the one you want. Depending on what you're doing, you may need to enter more than one symbol in the text box. For example, if your goal is to remove the tabs at the beginning of each paragraph and separate the paragraphs with blank lines instead, you would enter ^p^t in the Find What text box to search for a paragraph mark (which ends each paragraph) followed by a tab character (which begins the next paragraph).

  3. Click in the Replace With text box and use the Special button to insert the characters replacing the ones in the Find With text box. Using the same example, you would enter ^p^p in the Replace With text box to replace each instance of a paragraph mark followed by a tab with two paragraph marks, thus removing the tab and adding a blank line (see Figure 12.10).

    Figure 12.10. This find and replace operation will remove the tabs at the beginning of each paragraph and separate paragraphs with blank lines.

    graphics/12fig10.jpg

    graphics/lightbulb_icon.gif

    After you have learned the codes that Word uses for the various special characters, you can type them directly into the Find What and Replace With text boxes instead of using the Special button.


  4. Continue with the usual replace procedure.

graphics/lightbulb_icon.gif

You can combine text and symbols in the Find What and Replace With text boxes if you like. For example, you could search for the word Part wherever it follows a manual page break by typing ^mPart in the Find What box. (The symbol for a manual page break is ^m.)


Using Find and Replace to Remove Breaks Within Paragraphs

It's not uncommon to receive a documentperhaps a text-only file or text that was copied from an e-mail messagethat has paragraph marks () or line-break characters ( graphics/softenter.gif ) at the end of each line within the paragraphs (see Figure 12.11). Before you edit the document in Word, you will want to remove all of these extra symbols and only leave the two paragraph marks (or two line-break characters) at the end of the paragraphs. Rather than tediously removing the rogue symbols one by one, you can ask Word to remove them for you by following these steps:

  1. Make sure the Show/Hide button in the Standard toolbar is turned on so that you can see the paragraph marks or line-break characters. Press Ctrl+Home to move to the top of the document. (Or, if you only need to perform this operation on a particular block of text, select it now.)

  2. Choose Edit, Replace . In the Find What text box, type two of Word's codes for the appropriate symbol. (Use ^p^p if you are removing paragraph marks, or ^l^l if you're removing line-break characters.)

  3. In the Replace With text box, type two codes of your liking, such as [p][p] or [l][l]. Just make sure that your code does not appear anywhere in the text of the document because you will be replacing all of them momentarily. Perform the replace operation. Now the only or graphics/softenter.gif symbols left in the document will be the single ones at the end of lines within a paragraph, which you want to remove.

  4. Replace all instances of the symbol with nothing. In other words, enter either a ^p or an ^l in the Find What text box and leave the Replace With text box empty.

    graphics/lightbulb_icon.gif

    Depending on the document, you may need to type a single space in the Replace With text box instead. If leaving the Replace With text box empty results in a document where two words are run together at the end of each line, use Undo to reverse the find and replace procedure, and then repeat the steps with a space in the Replace With text box instead.


  5. Replace all instances of your two codes ([p][p] or [l][l]) with two of Word's symbols (^p^p or ^l^l).

Figure 12.11. You can use Find and Replace to strip out all of the paragraph marks or line-break characters within the paragraphs.

graphics/12fig11.jpg

Figure 12.12 shows the same document after the errant symbols have been stripped out.

Figure 12.12. All of the extra symbols are now gone from the document.

graphics/12fig12.jpg



Sams Teach Yourself Microsoft Office Word 2003 in 24 Hours
Sams Teach Yourself Microsoft Office Word 2003 in 24 Hours
ISBN: 067232556X
EAN: 2147483647
Year: 2003
Pages: 315
Authors: Heidi Steele

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net