Execute method (find object)
Run the specified search operation. If the search is successful, returnTrue.
Syntax
Expression. Execute (Findtext,Matchcase,Matchwholeword,Matchwildcards,Matchsoundslike,Matchallwordforms,Forward,Wrap,Format,Replacewith,Replace,Matchkashida,Matchdiacritics,Matchalefhamza,Matchcontrol)
ExpressionRequired. This expression returnsFindObject.
FindtextVariantType. Optional. Specify the text to be searched. You can use an empty string ("") to find the format. You can also specify appropriate charactersCodeSearch for special characters. For example, "^ P" corresponds to a paragraph mark, and "^ t" corresponds to a tab. If you want to use a special character list, see search for replacement special characters and document element examples.
IfMatchwildcardsIsTrueYou can specify wildcards and other advanced search conditions. For example, "* (ing)" searches for all words ending with "ing. For more information, see wildcard search examples.
To search for a symbolic character, enter the (^) character, zero (0), and then enter the code of the symbolic character. For example, "^ 0151" corresponds to a long dash (-).
MatchcaseVariantType. Optional. If yesTrue, The search text must be case sensitive. It is equivalent to the "case sensitive" check box in the "edit" menu "find and replace" dialog box.
MatchwholewordVariantType. Optional. IfTrueOnly the matching complete words, not the words that are part of a long word. It is equivalent to the "full match" check box in the "edit" menu "find and replace" dialog box.
MatchwildcardsVariantType. Optional. IfTrueThe searched text contains special search operators. It is equivalent to the "use wildcard" check box in the "edit" menu "find and replace" dialog box.
MatchsoundslikeVariantType. Optional. IfTrueTo find words with the same pronunciation as the words to be searched. It is equivalent to the "homophone" check box in the "edit" menu "find and replace" dialog box.
MatchallwordformsVariantType. Optional. IfTrueTo search for all forms of text (for example, "sit" will include "sitting" and "sat "). It is equivalent to the "Search for various forms of words" check box in the "edit" menu "find and replace" dialog box.
ForwardVariantType. Optional. IfTrueTo the end of the document.
WrapVariantType. Optional. If the search starts from a position not at the beginning of the document and reaches the end of the document (for exampleForwardSetFalse). Use this parameter to control the subsequent operations. When no search text is found in the selected content or area, this parameter also controls the subsequent operations. It can be the followingWdfindwrapConstant:
Constant |
Description |
Wdfindask |
After you search for the selected content or region, Microsoft Word displays a message asking if you want to search for other parts of the document. |
Wdfindcontinue |
When the start or end of the search area is reached, continue to perform the search operation. |
Wdfindstop |
When the start or end of the search range is reached, stop searching. |
FormatVariantType. Optional. IfTrue, The search format is not text.
ReplacewithVariantType. Optional. Replace text. To deleteFindThe text specified by the parameter. You can use an empty string (""). AndFindThe parameters are similar. This parameter can also specify special characters and advanced search conditions. To replace a graphic object or other non-text items, place these items on the clipboard and thenReplacewithIt is specified as "^ C ".
ReplaceVariantType. Optional. Number of replicas: one, all, or no. You canWdreplaceConstant:Wdreplaceall,WdreplacenoneOrWdreplaceone.
MatchkashidaVariantType. Optional. IfTrue, The search result should match the text in the Arabic document that distinguishes kashidas. This parameter may be unavailable because the selected or installed language supports different languages (for example, American English.
MatchdiacriticsVariantType. Optional. IfTrue, The search result should match the language text that distinguishes the tone symbol. This parameter may be unavailable because the selected or installed language supports different languages (for example, American English.
MatchalefhamzaVariantType. Optional. IfTrueIn the Arabic document, the search content should match the text that distinguishes Alef hamzas. This parameter may be unavailable because the selected or installed language supports different languages (for example, American English.
MatchcontrolVariantType. Optional. IfTrueIn the documents that use the language from the right to the left, the query content should distinguish between two-way control characters. This parameter may be unavailable because the selected or installed language supports different languages (for example, American English.
Description
Unless otherwise specified, the replaced text follows the format of the replaced text in the document. For example, if "XYZ" is used to replace "ABC", the bold "ABC" is replaced by the bold string "XYZ.
Similarly, ifMatchcaseIsFalse, The searched uppercase text will be replaced by the uppercase text, regardless of whether the searched text and the replaced text are case-insensitive. In the above example, "ABC" will be replaced by "XYZ.