Find and Replace

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a long, long document that is in unformatted text. Headings
containing not more than 10 words precede the first paragraph under each
heading. The paragraphs in each case contain more than 10 words.

I'm just wondering . . . .

How can I find a heading (a line of text with less than 10 words) preceded
by a paragraph mark and followed by a paragraph mark and change the font to
bold in each case? I have plenty of time to do it the long way around, but I
just love what you wonderful people have to say about my favorite
subject--Find and Replace. I tried finding a "paragraph followed by 1 to 10
words followed by a paragraph." I must have done something wrong, though,
because it keeps saying it cannot find it.

Thanks for all your help--past, present and future! I admire you folks so
very, very much.
 
Use a macro containing the following commands:

Dim i As Long
With ActiveDocument
For i = 1 To .Paragraphs.Count - 1
If .Paragraphs(i).Range.Words.Count < 10 Then
If .Paragraphs(i + 1).Range.Words.Count > 10 Then
.Paragraphs(i).Range.Font.Bold = True
End If
End If
Next i
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
 
Doug, thanks for this and all the help you've given me through the months (or
is it years?)!
 
Back
Top