Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Adding Tags to Text.

Adding Tags to Text

Written by Allen Wyatt (last updated May 30, 2020)
This tip applies to Word 97, 2000, 2002, and 2003


1

If you love working in HTML, you know that it is created by simply adding tags to regular text. Tags do nothing more than describe how a browser should display the text. HTML can be created by hand or automatically, by program. You can even use Word to create your HTML for you. What if you don't want Word to do the HTML automatically, but you want to use Word's tools to help you in your HTML creation? For instance, you might want to search for italicized text within a document and then surround it with the HTML tags that signify the text should be displayed in italics. You can do this by following these steps:
  1. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
  2. Click on the More button, if it is available. (See Figure 1.)
  3. Figure 1. The Replace tab of the Find and Replace dialog box.

  4. With the insertion point in the Find What box, click the Format button and choose Font. Word displays the Find Font dialog box. (See Figure 2.)
  5. Figure 2. The Find Font dialog box.

  6. In the Font Style list, choose Italic.
  7. Click on OK to dismiss the Find Font dialog box.
  8. In the Replace With box, enter "<i>^&</i>" (without the quote marks). Both <i> and </i> are HTML tags for italics, and ^& is the special code for the Find What text. In other words, you want to replace what you find with what you found, but make sure it is surrounded by the HTML tags for italics.
  9. With the insertion point still in the Replace With box, click the Format button and choose Font to again display the Find Font dialog box.
  10. Scroll down in the Font Style list and choose Not Italic. You want to do this so that when the find and replace operation is done, not only have you added the proper HTML tags, but you are turning off the italics attribute of the found text. This is important so that if you later run the same macro on the same document, you don't get large numbers of nested HTML tags.
  11. Click on OK to dismiss the Find Font dialog box.
  12. Click on Replace All to process the entire document, or use the other buttons in the Find and Replace dialog box to step through the occurrences of italic text one at a time.
The same find and replace technique can be used to add other HTML tags, as desired. For instance, you could add the tags for bold text, <b> and </b> by searching for Bold in step 4, using the proper tags in step 6, and replacing with Not Bold in step 8.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1904) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Adding Tags to Text.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Working with E-mailed Documents

Ding! You've got mail. That mail has a Word document attached to it. Before you rush off and open that document, take a ...

Discover More

Setting Default Attributes for Lines and Arrows

Don't like the way that Excel formats lines and arrows? You can easily make your own formatting changes, and then use ...

Discover More

Blank Lines Before Tables

Adding a blank line before your table is easy, but Word's behavior as you attempt to make the insert can depend on where ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

Searching for Character Formatting

Need to look for a piece of text possessing a particular formatting attribute? Here's the skinny on how this is accomplished.

Discover More

Replacing Hidden Text

Word allows you to format text so it can be easily hidden from view and from printing. If you want to convert the hidden ...

Discover More

Searching for Periods Not Followed by a Space

Most periods should be followed by at least one space. What if you think there may be some errors in how your post-period ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 - 0?

2020-05-31 14:13:52

DIANE NICHOLS

First of all: Is a macro the set of codes that inserts a particular preselected and preprogrammed phrase or code into a document?

One of the most frustrating parts of seeking information on computer tips is the way persons writing about these things assume that the reader understands the "lingo".

In Wikipedia there is a rule or an underlining under words that may be unfamiliar. When you click on those words, you are automatically taken to a place where the word or item or movement or piece of art, is defined or explained.


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.