View Single Post
 
Old 04-14-2012, 05: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

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