WD: How to Remove HTML Tags with a Word Macro

ID: Q131720

The information in this article applies to:

SUMMARY

This article provides a macro that selects and deletes HTML tags.

MORE INFORMATION

To remove HTML tags from your document, follow these steps:

1. On the File menu, click Open.

2. Click to select the Confirm Conversions check box and click your file.

3. Click OK.

4. In the Confirm Conversion dialog box, click Text Only.

5. Click OK.

6. After the document opens, run the following macro. This macro will find,

   select, and remove the HTML tags:

   Sub MAIN
      StartOfDocument
      EditFind .Find = "<", .Direction = 0, .MatchCase = 0, \ 
      .WholeWord = 0, .PatternMatch = 0,  .SoundsLike = 0, \ 
      .Format = 0, .Wrap = 2
      While EditFindFound()
         ExtendSelection ">"
         EditClear
         EditFind .Find = "<", .Direction = 0, .MatchCase = 0, \ 
         .WholeWord = 0, .PatternMatch = 0,  .SoundsLike = 0, \ 
         .Format = 0, .Wrap = 2
      Wend
   End Sub

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties or merchantability and/or fitness for a particular purpose.

Additional query words: internet assistant HTML hypertext markup language hyper text

Keywords          : kbmacro wordnt kbmacroexample winword kbwdinternet ntword macword word6 word7 word95 
Version           : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1
Platform          : MACINTOSH WINDOWS
Issue type        : kbhowto

Last Reviewed: September 20, 1998