Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Word 2003 - Find multiple items, select entire line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tailings - 04 Oct 2006 03:26 GMT
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!
Greg Maxey - 04 Oct 2006 04:10 GMT
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!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.