Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Advanced search and replace.
Hi,
i have a document looking like that: "this is a line with a word cat this is a line with a word dog this is a line with a word dog this is a line with a word cat this is a line with a word cat this is a line with a word dog this is a line with a word cat" What i have to do is to delete all the lines containing the word "cat". If it was only few lines i could just do it manually searching and deleting, but this document has more than 100 pages, and the lines are not one after another but they are among other sequences. Is there any way to automate such process? I thought about using replace function, but i don't think it's capable. With regards, Peter |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Advanced search and replace.
Use a macro containing the following code:
Dim myrange As Range Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="cat", Forward:=True, _ MatchWildcards:=False, Wrap:=wdFindStop, MatchCase:=False) = True Selection.Paragraphs(1).Range.Delete Loop End With -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Piotr" wrote in message ... Hi, i have a document looking like that: "this is a line with a word cat this is a line with a word dog this is a line with a word dog this is a line with a word cat this is a line with a word cat this is a line with a word dog this is a line with a word cat" What i have to do is to delete all the lines containing the word "cat". If it was only few lines i could just do it manually searching and deleting, but this document has more than 100 pages, and the lines are not one after another but they are among other sequences. Is there any way to automate such process? I thought about using replace function, but i don't think it's capable. With regards, Peter |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search and Insert, Search and Replace, Modify Document Margins | Formatting Long Documents | |||
advanced replace | Microsoft Word Help | |||
Advanced File Search on most Properties doesn't seem to work | Microsoft Word Help | |||
How advanced is the "replace" function in Word 2000? | Microsoft Word Help | |||
How advanced is the "replace" function in Word 2000? | New Users |