Range.GetSpellingSuggestions 方法 (Word)

返回一个 SpellingSuggestions 集合,代表文字建议作为指定范围中的第一个单词的拼写替换。

语法

表达式。GetSpellingSuggestions (CustomDictionary、IgnoreUppercase、MainDictionary、SuggestionMode、CustomDictionary2、CustomDictionary3、CustomDictionary4、CustomDictionary5、CustomDictionary6、CustomDictionary7、CustomDictionary8、CustomDictionary9、CustomDictionary10)

expression 是必需的。 一个代表 Range 对象的变量。

参数

名称 必需/可选 数据类型 说明
CustomDictionary 可选 Variant 表达式,可返回一个 字典 对象或自定义词典的文件名。
IgnoreUppercase 可选 Variant 真 要忽略全部大写的单词。 如果省略此参数,则使用 IgnoreUppercase 属性的当前值。
MainDictionary 可选 Variant 表达式,可返回一个 字典 对象或主词典的文件名。 如果不指定主词典,Word 会使用对应于该区域中的第一个单词的语言格式的主词典。
SuggestionMode 可选 Variant 指定 Word 提出拼写建议的方式。 可以是下列的 WdSpellingWordType 常量之一。 默认值是 wdSpellword 。
CustomDictionary2 – CustomDictionary10 可选 Variant 其中任何一个表达式,可返回一个 字典 对象或一个附加的自定义词典的文件名。 您可以指定多达 9 个附加词典。

返回值

SpellingSuggestions

备注

如果单词拼写正确, SpellingSuggestions 对象的 Count 属性将返回 0 (零)。

示例

以下示例查找所选范围的第一个单词的替换拼写建议。 如果存在建议,则该示例对所选内容运行拼写检查。

If Selection.Range.GetSpellingSuggestions.Count = 0 Then 
 Msgbox "No suggestions." 
Else 
 Selection.Range.CheckSpelling 
End If

另请参阅

Range 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。