I have large amounts of imported plain text that I need to format. I need a
macro that will look for the occurence off any number between 500 and 553
followed by two spaces then a hyphen, select the entire line containing it
and making it bold.
My initial attempt has the code repeated 54 times, with a different number
each time. There must be an easier way to do it!
Try:
Sub ScratchMacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "5^#^#"
While .Execute
If oRng < 554 Then
oRng.Select
With Selection
.Collapse wdCollapseEnd
.Bookmarks("\Line").Select
.Range.Bold = True
End With
End If
Wend
End With
End Sub

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> I have large amounts of imported plain text that I need to format. I
> need a macro that will look for the occurence off any number between
[quoted text clipped - 3 lines]
> My initial attempt has the code repeated 54 times, with a different
> number each time. There must be an easier way to do it!