![]() |
|
#1
|
|||
|
|||
![]() Code:
Sub findfunction() If (findHL(activedocument.Range, "[56, 47, 44, aeiou]")) = True Then MsgBox "Highlight vowels Done", vbInformation + vbOKOnly, "Vowels Highlight Result" End Sub Function findHL(r As Range, s As String) As Boolean Dim rdup As Range Set rdup = r.Duplicate rdup.Find.Wrap = wdFindStop Do While rdup.Find.Execute(findtext:=s, MatchWildcards:=True) = True If (Not rdup.InRange(r)) Then Exit Do rdup.HighlightColorIndex = wdBlue rdup.Collapse wdCollapseEnd Loop findHL = True End Function Last edited by macropod; 04-22-2012 at 08:42 PM. Reason: Fixed code tags |
#2
|
||||
|
||||
![]()
To highlight the vowels in a document, try something like:
Code:
Sub HilightVowels() Application.ScreenUpdating = False With ActiveDocument.Range .HighlightColorIndex = wdYellow With .Find .ClearFormatting .Forward = True .Wrap = wdFindContinue .Format = True .MatchWildcards = True .Text = "[!AEIOUaeiou]" With .Replacement .ClearFormatting .Highlight = False .Text = "^&" End With .Execute Replace:=wdReplaceAll End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
gsrikanth | Excel Programming | 1 | 04-18-2012 01:06 AM |
XML parsing & Object variable not set (Error 91) | tinfanide | Excel Programming | 0 | 12-29-2011 08:43 AM |
![]() |
Manit | Excel Programming | 4 | 12-08-2011 07:35 PM |
Problem: object library invalid or contains references to object definitions | aligahk06 | Office | 0 | 08-19-2010 12:29 PM |
find - reading highlight - highlight all / highlight doesn't stick when saved | bobk544 | Word | 3 | 04-15-2009 03:31 PM |