View Single Post
 
Old 04-20-2012, 01:22 AM
gsrikanth gsrikanth is offline Windows XP Office XP
Competent Performer
 
Join Date: Dec 2011
Posts: 133
gsrikanth is on a distinguished road
Default vba error (object required) for highlight vowels

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
Reply With Quote