Find.Execute2007 procedure builder

Find.Execute2007 (Word)

Runs the specified find operation. Returns True if the find operation is successful.

If MatchWildcards is True, you can specify wildcard characters and other advanced search criteria for the FindText argument. For example, "*(ing)" finds any word that ends in "ing". To search for a symbol character, type a caret (^), a zero (0), and then the symbol's character code. For example, "^0151" corresponds to an em dash (—). Unless otherwise specified, replacement text inherits the formatting of the text it replaces in the document. For example, if you replace the string "abc" with "xyz", occurrences of "abc" with bold formatting are replaced with the string "xyz" with bold formatting. Also, if MatchCase is False, occurrences of the search text that are uppercase will be replaced with an uppercase version of the replacement text, regardless of the case of the replacement text. Using the previous example, occurrences of "ABC" are replaced with "XYZ".

Execute2007 (FindText, MatchCase, MatchWholeWord, MatchWildcards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl, MatchPrefix, MatchSuffix, MatchPhrase, IgnoreSpace, IgnorePunct)

With Selection.Find 
 .ClearFormatting 
 .MatchWholeWord = True 
 .MatchCase = False 
 .Execute2007 FindText:="library" 
End With

Arguments

Optional arguments

The following arguments are optional

FindText - The text to be searched for. Use an empty string ("") to search for formatting only. You can search for special characters by specifying appropriate character codes. For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character

MatchCase - True to specify that the text to find should be case-sensitive. Corresponds to the Match case check box in the Find and Replace dialog box (on the Home tab in the Editing group)

MatchWholeWord - True to find only entire words, not text that is part of a larger word. Corresponds to the Find whole words only check box in the Find and Replace dialog box

MatchWildcards - True to use wildcard search operators in the text to find. Corresponds to the Use wildcards check box in the Find and Replace dialog box

MatchSoundsLike - True to locate words that sound similar to the text to find. Corresponds to the Sounds like check box in the Find and Replace dialog box

MatchAllWordForms - True to locate all forms of the text to find (for example, "sit" locates "sitting" and "sat"). Corresponds to the Find all word forms check box in the Find and Replace dialog box

Forward - True to search forward (toward the end of the document)

Wrap - One of the WdFindWrap constants that controls what happens if the search begins at a point other than the beginning of the document and the end of the document is reached (or vice versa if Forward is set to False). This argument also controls what happens if there is a selection or range and the search text is not found in the selection or range

Format - True to locate formatting in addition to, or instead of, the text to find

ReplaceWith - The replacement text. To delete the text specified by the Find argument, use an empty string (""). You specify special characters and advanced search criteria just as you do for the Find argument. To specify a graphic object or other nontext item as the replacement, move the item to the Clipboard and specify "^c" for ReplaceWith

Replace - One of the WdReplace constants that specifies how many replacements are to be made: one, all, or none

MatchKashida - True to find matching kashidas in an Arabic-language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed

MatchDiacritics - True to find matching diacritics in a right-to-left language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed

MatchAlefHamza - True to find matching alef hamzas in an Arabic-language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed

MatchControl - True to find matching bidirectional control characters in a right-to-left language document. This argument may not be available to you, depending on the language support (for example, U.S. English) that you have selected or installed

MatchPrefix - True to find words that begin with the search string. Corresponds to the Match prefix check box in the Find and Replace dialog box

MatchSuffix - True to find words that end with the search string. Corresponds to the Match suffix check box in the Find and Replace dialog box

MatchPhrase - True to ignore all white space and control characters between words

IgnoreSpace - True to ignore all white space between words. Corresponds to the Ignore white-space characters check box in the Find and Replace dialog box

IgnorePunct - True to ignore all punctuation characters between words. Corresponds to the Ignore punctuation check box in the Find and Replace dialog box