Code to "white-out" specific lines in a very large Word document

J

John

Hi

For the lines that start with the following text, I'd like like to
change the font colour of the ENTIRE line to white:
- Diagnosis:
- Rating:
- Analogue:

(note the colon [:] at the end in each case)


Thanks very much

John
 
G

Graham Mayor

If by 'line', which is a vague concept, you mean 'paragraph' then

Dim vFindText
Dim oRng As Range
Dim i As Long
vFindText = Array("- Diagnosis:", "- Rating:", "- Analogue:")
For i = 0 To UBound(vFindText)
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = vFindText(i)
Do While .Execute(Forward:=True) = True
oRng.Paragraphs(1).Range.Font.Color = wdColorWhite
Loop
End With
Next

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top