WD: How to Remove HTML Tags with a Word Macro

Last reviewed: February 5, 1998
Article ID: Q131720
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1
  • Microsoft Word for Windows NT, version 6.0
  • Microsoft Word for Windows 95, versions 7.0, 7.0a

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 : kbmacroexample macword ntword winword word6 word7 word95 word97 wordnt kbwdinternet kbmacro
Version : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a; MACINTOSH:6.0,6.0.1
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.