Clear settings from Find and Replace dialog to prevent unexpected results from future Find or Replace operations

Article contributed by Bill Coan

To prevent the user from having to change the settings in the Find and Replace dialog after running your macros, make sure you call the following procedure after doing any Find and Replace operations in VBA.

Sub ClearFindAndReplaceParameters()

With Selection.Find
   .ClearFormatting
   .Replacement.ClearFormatting
   .Text = ""
   .Replacement.Text = ""
   .Forward = True
   .Wrap = wdFindStop
   .Format = False
   .MatchCase = False
   .MatchWholeWord = False
   .MatchWildcards = False
   .MatchSoundsLike = False
   .MatchAllWordForms = False
End With

End Sub