Is this what you're looking for? Pass "" for sReplaceText for find operation only. Function returns True upon success.
Function FindReplaceText(ByVal sFindText As String, ByVal sReplaceText, Optional ByVal bMatchWholeWord As Boolean = False, Optional ByVal bMatchCase As Boolean = False, Optional ByVal bForward As Boolean = True, Optional ByVal iWrap As Integer = 1) As Boolean
FindReplaceText = False
If Documents.Count >= 1 Then
With Selection.Find
.ClearFormatting
.MatchWholeWord = bMatchWholeWord
.MatchCase = bMatchCase
.Text = sFindText
.Replacement.Text = sReplaceText
.Forward = bForward
.Wrap = iWrap ' 0: no wrap, 1: wrap, 2: ask user
FindText = .Execute
End With
End If
End Function
|