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 / August 2007

Tip: Looking for answers? Try searching our database.

Highliting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steved - 30 Aug 2007 20:10 GMT
Hello from Steved

Using the examples below please what do I Need to do with the below macro,
as what it does at the moment it will highlite the next word in a paragraph
for example 15 STAR OF JUDD 3766 JUST DESERTS 25 it will highlite to DESERTS
I only want it to highlite to the last character in this case D ( JUDD )
Thankyou

15 STAR OF JUDD not 3766
14 LADY EXPRESS not 3566
9 DANZATIGER      not 2063

Sub Highlighting()
Dim rPrg As Range
With Selection
  .Collapse
  .ExtendMode = False
  Set rPrg = .Paragraphs(1).Range
End With
With rPrg.Find
  .Text = "[A-Z]"
  .MatchWildcards = True
  .Forward = False
  .Execute
  rPrg.Start = Selection.Paragraphs(1).Range.Start
  rPrg.HighlightColorIndex = wdYellow
End With
End Sub
Doug Robbins - Word MVP - 30 Aug 2007 20:42 GMT
Search for

[0-9]1,[A-Z ]{1,}[0-9]{4}

then set a range to the text that is selected then use

Range.End = Range.End - 5 to exclude the four digit number and the space
before it from the range and apply the highlight to that range.

Signature

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

> Hello from Steved
>
[quoted text clipped - 26 lines]
> End With
> End Sub
Steved - 30 Aug 2007 20:56 GMT
Thankyou Doug

> Search for
>
[quoted text clipped - 35 lines]
> > End With
> > End Sub

Rate this thread:






 
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.