Skip to content

The Replace function in Office - Part 2

We continue our look at the “Replace” function in Office by examining more advanced replacing techniques.

By Michael Barden

In the last issue of Office for Mere Mortals we looked at how to search within a document in the various Office programs. There is a lot of hidden power accompanying the relatively simple process of finding text within a document.

In this issue we’ll continue our look at Replace features in Office.


REPLACING SPECIAL CHARACTERS USING WILDCARDS

Replacing special characters is another useful and less obvious ability of the Microsoft Word ‘Find and Replace’ dialog. After bringing up the replace dialog box, click the ‘More’ button to bring up additional options. Now click the ‘Special’ button to bring up a drop-down list, and click the item you want to include in your search.

The special characters include paragraph marks, tab characters and page breaks to name a few of the more recognizable ones. This will be displayed by a wildcard (a type of code that was described in the last issue of OfMM) in the ‘Find what’ text box.

Replacing the item is simply a matter of entering what you want to use as a replacement in the ‘Replace with’ text box, followed by clicking ‘Find Next’, ‘Replace’ or ‘Replace All’. Special characters can also be used in the ‘Replace with’ text box in the same way.

EXAMPLE: REPLACING TWO PARAGRAPH MARKS WITH A SINGLE PARAGRAPH MARK

One thing we have learned from the last two newsletters is how to use special codes prefixed with ^ to find or replace special characters you can’t type in the usual way.

The representation of a paragraph mark is ^p. It is important to realize that a paragraph mark (which is represented by ^p in Find | Replace and shows up on the screen as a funny reversed P with two down-strokes) is not equivalent to a paragraph character (which is represented by ^v).

The paragraph is normally hidden but can be seen when you choose to view all characters (Tools | Options | Formatting marks | All).

When you paste text from one place to another – between web pages, emails and documents you can sometimes end up with too many paragraph marks or not enough. Or you might want to replace twin paragraph marks with single marks and handle the spacing between paragraphs using a style instead.

Replace can help you fix these paragraph mark problems quickly.

Replacing two paragraph marks with a single paragraph mark is done by typing ^p^p into the ‘Find what’ text box, and typing a single ^p into the ‘Replace with’ text box. After hitting ‘Replace All’, every double spaced paragraph will be replaced with a single spaced paragraph. Importantly, the styles of each of the paragraphs will be retained.

REPLACING SYMBOLS

As for using a symbol in the Find and Replace box, the easiest way is to copy one instance of the symbol to the clipboard and paste it into the Find what box.

If you want to replace specific text with a symbol you can create one instance of the symbol, cut it to the clipboard, and paste it in the Replace With box.

Just select Insert | Symbol from the menu, find the desired symbol, and click on Insert. Cut that symbol to the clipboard, paste it into the Replace With box, and you’re ready to go.

REPLACING

IN FRONTPAGE

For those of you familiar with HTML, you may also be familiar with some bad programming practices such as using multiple “line-break” tags
to mimic the spacing achieved with a paragraph

tag. You can also end up with

tags after pasting text into Frontpage.

The replace function can be used in Microsoft Frontpage the same way as in the rest of the Office suite by selecting it from the ‘Edit’ menu or simply using the Ctrl-H keyboard shortcut. Except that in Frontpage you have the option to find/replace the text on the web page or the underlying HTML source code – click on ‘Find in Source Code’ if you want to work on the HTML.

Searching for

and replacing it with

is a good way to ensure that your code conforms with better practices.

Why

? Well the first tag

ends a previously started paragraph tag. The second tag opens up a new paragraph tag. A paragraph tag is a so-called “container” tag, which is used to group a logical paragraph of information together in a similar way that a paragraph mark in Microsoft Word would. A
line break tag on the other hand is a self-contained tag, and gives no meaning to the structure of the HTML document. It is a quick-fix tool to hard-code a line-break.

HOW TO REMOVE SOMETHING ENTIRELY

If you wish to remove something entirely from your document, simply open up the ‘Replace’ dialog box and type in the word or phrase which you wish to remove into the ‘Find what’ text box. The important step here is to leave the ‘Replace with’ text box completely empty. In this way, you will replace the text with nothing at all, which effectively removes it entirely from the document.

A common use for this is in Frontpage after you’ve pasted in some text from Word. Office ‘helps’ you by including all sorts of additional tags that you may not want.

Here at Office Watch comedy central we’re forever replacing class=”msoNormal” with blank so that

becomes just

or the space consuming   with a single space.

 

About this author