Loading
Word.Tips.Net WordTips (Menu Interface)

Adding Tags to Text

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.

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.

Related Tips:

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

 

Leave your own comment:

*Name:
Email:
  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*Text:
*What is 5+3 (To prevent automated submissions and spam.)
 
 
           Commenting Terms

Comments for this tip:

Rafal    13 May 2016, 06:42
I noticed now that this method don't work propierty for text in table cell.

For example. If below only "bold" word is bolded:

This is bold text

then in results I have:

This is bold<b></b> text

Sanjay Kumar    21 Jan 2016, 05:52
How will convert XML tag to MS word style using the macro in MS 2003 eg. XML TAg is <abc> and style in ms word should be same e.g "abc".
DD    08 Aug 2015, 04:55
I've got word 97 and am trying to create paragraph tags. Have tried to follow your advice but got stuck. Should I be doing something different.
Ivan    24 Oct 2013, 12:56
Thank you! It is exactly what I was looking for. ++++
 
 

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

 

Advertise with Us

Our Privacy Policy

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives

 

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.