Word 2003 - Find multiple items, select entire line

T

Tailings

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!
 
G

Greg Maxey

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
 

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