Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I divide a page into three sections? | Microsoft Word Help | |||
WP Delay Code - Word Equiv | Microsoft Word Help | |||
Continuous breaks convert to next page breaks | Microsoft Word Help | |||
macro in word | Microsoft Word Help | |||
How do I convert a cd in word perfect to microsoft word | Microsoft Word Help |