You are on page 1of 3

8/23/2017 Adding Tags to Text (Microsoft Word)

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 (https://wordribbon.tips.net/T012991_Adding_Tags_to_Text).

Adding Tags to Text


by Allen Wyatt (https://www.tips.net/Authors/A0001_Allen_Wyatt.html) 4
(last updated October 12, 2013) (https://word.tips.net/T001904_Adding_Tags_to_Text.html#
form-
hd)
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.)

Figure 1. The Replace tab of the Find and Replace dialog box.
3. 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.)

Figure 2. The Find Font dialog box.


4. In the Font Style list, choose Italic.
5. Click on OK to dismiss the Find Font dialog box.
6. 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.
7. 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.
8. 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.
9. Click on OK to dismiss the Find Font dialog box.
10. 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.
(https://word.tips.net/T001904_Adding_Tags_to_Text.html#comment-form-hd)
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 (https://wordribbon.tips.net/T012991_Adding_Tags_to_Text).

Author Bio

Allen Wyatt

https://word.tips.net/T001904_Adding_Tags_to_Text.html 1/3
8/23/2017 Adding Tags to Text (Microsoft Word)
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 (http://www.sharonparq.com), a computer and publishing services company. Learn more about Allen
(https://www.tips.net/Authors/A0001_Allen_Wyatt.html)...

MORE FROM ALLEN

Searching for All Quickly Dumping Array Contents


When you are working on a worksheet (particularly a large one), you Variable arrays are used quite often in macros. If you use an array once
may want to search for and possibly copy information from ... in your macro and then need to reuse it for ...
Discover More Discover More
(https://excelribbon.tips.net/T008964_Searching_for_All.html) (https://excelribbon.tips.net/T009393_Quickly_Dumping_Array_Contents.html)

Examining Styles and Macros in a Template


Templates are very powerful with the ability to contain both styles and
macros. If you want to see what styles and macros are ...
Discover More
(https://wordribbon.tips.net/T012715_Examining_Styles_and_Macros_in_a_Template.html)

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly
candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it
all out! Check out Word 2013 For Dummies (http://go.tips.net/am12) today!

More WordTips (menu)

Selective Formatting using Find and Replace Searching for Character Formatting
The Find and Replace tool in Word allows you to check for formatting Need to look for a piece of text possessing a particular formatting
in what you search for and use formatting in your ... attribute? Here's the skinny on how this is accomplished.
Discover More Discover More
(https://word.tips.net/T000436_Selective_Formatting_using_Find_and_Replace.html)
(https://word.tips.net/T000256_Searching_for_Character_Formatting.html)

Finding Formatted Bulleted Paragraphs


Want to find the bulleted paragraphs within a large document? Word
doesn't have a built-in way to search for this formatting. ...
Discover More
(https://word.tips.net/T000189_Finding_Formatted_Bulleted_Paragraphs.html)

Subscribe

FREE SERVICE: Get tips like this every week in Enter email
WordTips, a free productivity newsletter. Enter your address
and click "Subscribe."
View most recent newsletter. (/ci.html) Subscribe
(Your e-mail address is not shared with anyone, ever.)
(https://www.tips.net/privacy.html)

Comments

Join the Conversation...

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}] in your comment text. Youll be prompted
to upload your image when you submit the comment. Maximum image size is 8Mpixels. 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.

Name Email

Notify me about new comments ONLY FOR THIS TIP


What is 6 - 3?
Notify me about new comments ANYWHERE ON THIS SITE

Hide my email address


Submit Comment

2016-05-13 06:42:57
I noticed now that this method don't work propierty for text in table cell.
Rafal
For example. If below only "bold" word is bolded:

This is bold text

then in results I have:

This is bold<b></b> text

2016-01-21 05:52:38
How will convert XML tag to MS word style using the macro in MS 2003 eg. XML TAg is
Sanjay Kumar <abc> and style in ms word should be same e.g "abc".


https://word.tips.net/T001904_Adding_Tags_to_Text.html 2/3
8/23/2017 Adding Tags to Text (Microsoft Word)
2015-08-08 04:55:16
I've got word 97 and am trying to create paragraph tags. Have tried to follow your advice but
DD got stuck. Should I be doing something different.

2013-10-24 12:56:40
Thank you! It is exactly what I was looking for. ++++
Ivan

Copyright 2017 Sharon Parq Associates, Inc. (http://www.sharonparq.com)

https://word.tips.net/T001904_Adding_Tags_to_Text.html 3/3

You might also like