Reply
 
Thread Tools Display Modes
  #1   Report Post  
Carl
 
Posts: n/a
Default How do I delete all non matching lines in a word file?

I have a large file that I would like to cull out all the lines that do not
contain a tag/header. How do I do this?
  #2   Report Post  
Greg
 
Posts: n/a
Default

Carl,

If the tag/header is in a Heading style (i.e., Heading 1), you could
use a macro like:

Sub DeleteText()

Dim oStyle As Style
Dim oPara As Paragraph

For Each oPara In ActiveDocument.Paragraphs
Set oStyle = oPara.Style
If oStyle "Heading 1" Then
oPara.Range.Delete

End If
Next oPara
End Sub

If that is not the case then you may be able to use a series of find
and replace.

Say you have

XX-Parts:
blah, blah,
XX-Labor
blah, blah
etc.

Your heading "Tag" is XX-

EditReplaceMore Use Wildcards

Type (XX-)(*)^13 in the find what field
Click in the replace with field then click the format button and click
highlight.
Your tagged headers should appear as highlighted text.

Now click in the find what field, clear the contents, uncheck the Use
Wildcards. Click in the replace with field and then press the no
format button. Go back to the Find what field and click format
hightlight twice. Format "Not Highlight" should appear beneath the
find what window. Press replace all

Now all that is left is highlighted Header text.

Select all (CTRL+a) and use the highlighting tool (located on the
reviewing toolbar) to remove highlighting

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I divide a page into three sections? Bonnie Microsoft Word Help 3 May 8th 23 02:47 AM
WP Delay Code - Word Equiv Mike G - Milw, WI Microsoft Word Help 6 January 10th 05 04:12 PM
Continuous breaks convert to next page breaks Jennifer Hunt Microsoft Word Help 2 December 30th 04 05:45 PM
macro in word js Microsoft Word Help 1 December 28th 04 03:01 AM
How do I convert a cd in word perfect to microsoft word greylady Microsoft Word Help 1 November 23rd 04 07:03 PM


All times are GMT +1. The time now is 03:49 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"