From: John on
Hi

I have a large Word document, several hundred pages long.

I would like to do the following

Find each and delete every line that starts "Comments:", "Author:",
"MyRating:".

These are typically the first 3 lines of every page, but it can vary.

I am doing this manually, but am curious to know if it's possible do
it using a macro. My guess is this is too complex to do using a
macro.

Thanks
From: Graham Mayor on
Dim sText() As String
Dim oRng As Range
Dim i As Long
sText = Split("Comments:,Author:,MyRating:", ",")
For i = 0 To UBound(sText)
Selection.HomeKey wdStory
With Selection.Find
Do While .Execute(findText:=sText(i))
Set oRng = Selection.Paragraphs(1).Range
If InStr(1, oRng, sText(i)) = 1 Then
oRng.Delete
End If
Loop
End With
Next i

should do the trick.
Note that the search is case sensitive

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>




"John" <helpme.code(a)yahoo.com> wrote in message
news:44a0385c-5345-4bc1-bd53-cf504afd92cc(a)j21g2000yqh.googlegroups.com...
> Hi
>
> I have a large Word document, several hundred pages long.
>
> I would like to do the following
>
> Find each and delete every line that starts "Comments:", "Author:",
> "MyRating:".
>
> These are typically the first 3 lines of every page, but it can vary.
>
> I am doing this manually, but am curious to know if it's possible do
> it using a macro. My guess is this is too complex to do using a
> macro.
>
> Thanks