Find 方法 (Word) HitHighlight 方法Find.HitHighlight method (Word)

突出显示找到的所有匹配项并返回一个 boolean 类型的值 ,该值代表是否找到匹配项。Highlights all found matches and returns a Boolean that represents whether matches were found.

语法Syntax

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

_表达式_一个返回Find对象的表达式。expression An expression that returns a Find object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
FindTextFindText 必需Required VariantVariant 指定要查找的文本。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. 例如, "^p"对应于一个段落标记, 并"^t"对应于一个 tab 字符。For example, "^p" corresponds to a paragraph mark and "^t" corresponds to a tab character.
HighlightColorHighlightColor 可选Optional VariantVariant 指定文本的突出显示颜色。Specifies the highlight color for the text. 可以是任何 RGB 颜色或 WdColor 常量之一。Can be any RGB color or one of the WdColor constants.
TextColorTextColor 可选Optional VariantVariant 指定文本的颜色。Specifies the color of the text. 可以是任何 RGB 颜色或 WdColor 常量之一。Can be any RGB color or one of the WdColor constants.
MatchCaseMatchCase 可选Optional VariantVariant True 指定查找文本是区分大小写。True to specify that the find text be case-sensitive. 对应于 查找和替换对话框中的 区分大小写复选框。Corresponds to the Match case check box in the Find and Replace dialog box.
MatchWholeWordMatchWholeWord 可选Optional VariantVariant 要查找操作只查找整个单词,而非较长单词的一部分的文字。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.
MatchPrefixMatchPrefix 可选Optional VariantVariant 才能匹配以搜索字符串开头的单词。True to match words beginning with the search string. 对应于 查找和替换对话框中的 区分前缀复选框。Corresponds to the Match prefix check box in the Find and Replace dialog box.
MatchSuffixMatchSuffix 可选Optional VariantVariant 才能匹配以搜索字符串结尾的单词。True to match words ending with the search string. 对应于 查找和替换对话框中的 区分后缀复选框。Corresponds to the Match suffix check box in the Find and Replace dialog box.
MatchPhraseMatchPhrase 可选Optional VariantVariant 真正 忽略所有空格和控制字符,词与词之间。True ignores all white space and control characters between words.
MatchWildcardsMatchWildcards 可选Optional VariantVariant 要查找的文字是特殊搜索操作符。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.
MatchSoundsLikeMatchSoundsLike 可选Optional VariantVariant 类似于查找的文字发音单词 ,则返回 true ,则查找操作定位。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.
MatchAllWordFormsMatchAllWordForms 可选Optional VariantVariant ,则返回 true ,则查找操作定位查找文字的所有形式 (例如,"sit"查找"坐",而"坐")。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.
MatchByteMatchByte 可选Optional VariantVariant True 在搜索过程中区分全角和半角字母或字符。True to distinguish between full-width and half-width letters or characters during a search.
MatchFuzzyMatchFuzzy 可选Optional VariantVariant True 在搜索过程中对日语文本使用非特定搜索选项。True to use the nonspecific search options for Japanese text during a search. 读/写。Read/write.
MatchKashidaMatchKashida 可选Optional VariantVariant 如此 如果查找操作用 kashida 阿拉伯语语言的文档中匹配的文本。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.
MatchDiacriticsMatchDiacritics 可选Optional VariantVariant 如此 如果查找操作用匹配从右到左语言的文档中的音调符号来匹配文字。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.
MatchAlefHamzaMatchAlefHamza 可选Optional VariantVariant 如此 如果查找操作用匹配 alef hamza 适用于阿拉伯语语言的文档中匹配的文本。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.
MatchControlMatchControl 可选Optional VariantVariant 如此 如果查找操作用匹配的从右到左语言的文档中的双向控制字符来匹配文字。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.
IgnoreSpaceIgnoreSpace 可选Optional VariantVariant 会忽略单词之间的所有空格。True ignores all white space between words. 对应于 查找和替换对话框中的 忽略空格复选框。Corresponds to the Ignore white-space characters check box in the Find and Replace dialog box.
IgnorePunctIgnorePunct 可选Optional VariantVariant True ,则忽略单词之间的所有标点符号。True ignores all punctuation characters between words. 对应于 查找和替换对话框中的 忽略标点符号复选框。Corresponds to the Ignore punctuation check box in the Find and Replace dialog box.
HanjaPhoneticHangulHanjaPhoneticHangul 可选Optional VariantVariant 会忽略朝鲜文字和朝鲜文汉字的拼音字符。True ignores phonetic hangul and hanja characters. 有朝鲜语支持时才可用。Available only if you have support for Korean languages.

返回值Return value

布尔值Boolean

备注Remarks

HitHighlight方法主要应用于将 Word 指定为电子邮件编辑器时, Office Outlook 中的搜索突出显示。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. 否则,使用 Execute 方法。Otherwise, use the Execute method.

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.