Find.HitHighlight Method (Word)

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

Syntax

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

expression An expression that returns a Find object.

Parameters

Name

Required/Optional

Data Type

Description

FindText

Required

Variant

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.

HighlightColor

Optional

Variant

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

TextColor

Optional

Variant

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

MatchCase

Optional

Variant

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

Optional

Variant

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

Optional

Variant

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

MatchSuffix

Optional

Variant

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

MatchPhrase

Optional

Variant

True ignores all white space and control characters between words.

MatchWildcards

Optional

Variant

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

Optional

Variant

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

Optional

Variant

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

Optional

Variant

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

MatchFuzzy

Optional

Variant

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

MatchKashida

Optional

Variant

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

Optional

Variant

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

Optional

Variant

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

Optional

Variant

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

Optional

Variant

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

IgnorePunct

Optional

Variant

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

HanjaPhoneticHangul

Optional

Variant

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

Return Value

Boolean

Remarks

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

See Also

Concepts

Find Object

Find Object Members