返回一个 SpellingSuggestions 集合,该集合代表指定单词的建议拼写替换单词。
语法
expression。 GetSpellingSuggestions
( _Word_
, _CustomDictionary_
, _IgnoreUppercase_
, _MainDictionary_
, _SuggestionMode_
, _CustomDictionary2_
, _CustomDictionary3_
, _CustomDictionary4_
, _CustomDictionary5_
, _CustomDictionary6_
, _CustomDictionary7_
, _CustomDictionary8_
, _CustomDictionary9_
, _CustomDictionary10_
)
expression 是必需的。 一个代表“全局”对象的变量。
参数
名称 | 必需/可选 | 数据类型 | 说明 |
---|---|---|---|
Word | 必需 | String | 将接受拼写检查的单词。 |
IgnoreUppercase | 可选 | Variant | 真 要忽略全部大写的单词。 如果省略此参数,则使用 IgnoreUppercase 属性的当前值。 |
SuggestionMode | 可选 | Variant | 指定 Word 提出拼写建议的方式。 可以是下列的 WdSpellingWordType 常量之一: wdAnagram 、 wdSpellword 或 wdWildcard 。 默认值是 WdSpellword 。 |
备注
如果单词拼写正确, SpellingSuggestions 对象的 Count 属性将返回 0 (零)。
示例
此示例查找单词 "*ook."
“建议”的备用拼写建议,包括通配符的 *
替换项。 任何建议的拼写都显示在消息框中。
Sub DisplaySuggestions()
Dim sugList As SpellingSuggestions
Dim sug As SpellingSuggestion
Dim strSugList As String
Set sugList = GetSpellingSuggestions(Word:="lrok", _
SuggestionMode:=wdSpellword)
If sugList.Count = 0 Then
MsgBox "No suggestions."
Else
For Each sug In sugList
strSugList = strSugList & vbTab & sug.Name & vbLf
Next sug
MsgBox "The suggestions for this word are: " _
& vbLf & strSugList
End If
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。