Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Adding Tags to Text.

Adding Tags to Text

Written by Allen Wyatt (last updated March 5, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


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 "<em>^&</em>" (without the quote marks). Both <em> and </em> are HTML tags for italic, 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 italic.
  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, <strong> and </strong> 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 (12991) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Word 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

Moving Text Using the Mouse

Many people use the keyboard to do their primary editing tasks. Word doesn't limit you to the keyboard, however. You can ...

Discover More

Displaying Edits by Date

Track Changes is a great tool; it allows you to see what changes were made in a document and then determine whether you ...

Discover More

Returning to Your Document after Adding an Endnote

Endnotes are a required element in some types of writing. When you add an endnote, Word moves you to the end of your ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Using Search Text in the Replacement

When you use the Find and Replace tool in Word, you may want to include what you searched for in the replacement text. ...

Discover More

Removing HTTP from URLs

Having problems when it comes to replacing information in URLs? You're not the only one; it can be confusing making mass ...

Discover More

Replacing with Plain Text

When using Find and Replace, how your replacements are formatted will depend on how the text being replaced is formatted. ...

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 1 + 1?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu 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.