![]() |
|
#1
|
|||
|
|||
|
I am creating a macro to assist with the teaching of Braille for the sighted.
The aim is to highlight in a Word document every occurrence of the characters ER, but only when they occur in the word SEVERE. I have written code to find occurrences of SEVERE, but I cannot work out how to highlight only the letters ER in every occurrence of the word SEVERE. If someone can help, I would be very grateful. The code, as far as I have gone at this stage: Code:
Sub Highlight_ER_in_SEVERE()
'
'Search for "severe". Highlight only the letters "er".
Set oRng = ActiveDocument.Range
With oRng.Find
.MatchWholeWord = True
.Text = "severe"
.Wrap = wdFindStop 'stops at the end of the document
While .Execute
oRng.HighlightColorIndex = wdGreen
Wend
End With
End Sub
Last edited by macropod; 02-18-2013 at 04:16 AM. Reason: Added code tags & formatting |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
count how many tims a certain value occurs
|
lucnijs | Excel | 6 | 03-26-2012 09:29 AM |
Highlight the first X number of characters
|
14spar15 | Word | 1 | 11-13-2011 11:17 PM |
| Highlight Document | Jodib | PowerPoint | 1 | 10-14-2011 07:25 AM |
| Junk characters (box-like characters) in Word file | Sashikala | Word | 1 | 04-20-2010 02:03 PM |
| find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |