Find.HitHighlight procedure builder

Find.HitHighlight (Word)

Highlights all found matches and returns a Boolean that represents whether matches were found.

The HitHighlight method applies primarily to search highlighting in Office Outlook when Word is specified as the email editor. However, you can use this method on documents inside Word if you want to highlight found text. Otherwise, use the Execute method.

HitHighlight (FindText, HighlightColor, TextColor, MatchCase, MatchWholeWord, MatchPrefix, MatchSuffix, MatchPhrase, MatchWildcards, MatchSoundsLike, MatchAllWordForms, MatchByte, MatchFuzzy, MatchKashida, MatchDiacritics, MatchAlefHamza, MatchControl, IgnoreSpace, IgnorePunct, HanjaPhoneticHangul)

Dim strFindText As String: strFindText =  
Dim booHitHighlight As Boolean
booHitHighlight = Selection.Find.HitHighlight(FindText:=strFindText)

Arguments

The following argument is required

FindText - Specifies the text to find. 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

Optional arguments

The following arguments are optional

HighlightColor - Specifies the highlight color for the text. Can be any RGB color or one of the WdColor constants

TextColor - Specifies the color of the text. Can be any RGB color or one of the WdColor constants

MatchCase - True to specify that the find text be case-sensitive. Corresponds to the Match case check box in the Find and Replace dialog box

MatchWholeWord - True to have the find operation locate 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

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

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

MatchPhrase - True ignores all white space and control characters between words

MatchWildcards - True to have the find text be a special search operator. Corresponds to the Use wildcards check box in the Find and Replace dialog box

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

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

MatchByte - True to distinguish between full-width and half-width letters or characters during a search

MatchFuzzy - True to use the nonspecific search options for Japanese text during a search. Read/write

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

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

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

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

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

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

HanjaPhoneticHangul - True ignores phonetic hangul and hanja characters. Available only if you have support for Korean languages