October 1999
Beginner
410 pages
10h 45m
English
The Execute method of the Find object actually has a number of parameters that allow an alternative syntax for doing a search and replace. The full syntax of the Execute method is:
FindObject.Execute(FindText, MatchCase, MatchWholeWord,_MatchWildcards, MatchSoundsLike, MatchAllWordForms, _Forward, Wrap, Format, ReplaceWith, Replace)
For instance, the previous search and replace could have been coded as follows:
Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting Selection.Find.Execute _ FindText:="find", _ ReplaceWith:="replace", _ Forward:=True, _ Wrap:=wdFindContinue, _ MatchCase:=False, _ MatchWholeWord:=False, _ MatchWildcards:=False, _ MatchSoundsLike:=False, _ MatchAllWordForms:=False, _ replace:=wdReplaceAll
This syntax seems to be a bit less readable than the previous one, but you may run across it when reading other code.
Read now
Unlock full access