D
Designingsally
-*Hi, I m writing macro for showing comments when certain words are
encountered.
Code is compiling well, but when I m executing the code I m encountering
with an error. The error description goes like this
Run-time error '5610'
the find what text for a find all word forms search can only contain
alphabetic letters.
When I remove - in the word "re enter". i m not encountering any error.
Clearly I have messed some declaration wrong.
can someone tell me what i must do so that macros accept words "re-enter" as
such. i have posted the code below.
thanks in advance.
Dim vFindText As Variant
Dim i As Long
vFindText = Array("Re-enter")
For i = 0 To UBound(vFindText)
With Selection
.HomeKey wdStory
With .FInd
.MatchCase = True
.MatchWholeWord = True
.ClearFormatting
Do While .Execute(findText:=vFindText(i), _
Forward:=True)
Selection.comments.Add _
Range:=Selection.Range, Text:="Kindly rephrase."
Loop
End With
End With
Next
I believe in Hope.
DesigningSally
encountered.
Code is compiling well, but when I m executing the code I m encountering
with an error. The error description goes like this
Run-time error '5610'
the find what text for a find all word forms search can only contain
alphabetic letters.
When I remove - in the word "re enter". i m not encountering any error.
Clearly I have messed some declaration wrong.
can someone tell me what i must do so that macros accept words "re-enter" as
such. i have posted the code below.
thanks in advance.
Dim vFindText As Variant
Dim i As Long
vFindText = Array("Re-enter")
For i = 0 To UBound(vFindText)
With Selection
.HomeKey wdStory
With .FInd
.MatchCase = True
.MatchWholeWord = True
.ClearFormatting
Do While .Execute(findText:=vFindText(i), _
Forward:=True)
Selection.comments.Add _
Range:=Selection.Range, Text:="Kindly rephrase."
Loop
End With
End With
Next
I believe in Hope.
DesigningSally