CheckSpelling Method
Applies To
Application object, Document object, Global object, Range object.
Description
Syntax 1: Begins a spelling check for the specified document or range. If the document or range contains errors, this method displays the Spelling and Grammar dialog box (Tools menu), with the Check grammar check box cleared. For a document, this method checks all available stories (such as headers, footers, and text boxes).
Syntax 2: Checks a string for spelling errors. Returns True if the string has no spelling errors.
Syntax 1
expression.CheckSpelling(CustomDictionary, IgnoreUppercase, AlwaysSuggest,
ú CustomDictionary2 – CustomDictionary10)
Syntax 2
expression.CheckSpelling(Word, CustomDictionary, IgnoreUppercase, MainDictionary,
ú CustomDictionary2 – CustomDictionary10)
expression Syntax 1: Required. An expression that returns a Document or Range object.
Syntax 2: Optional. An expression that returns an Application object.
Word Required String. The text whose spelling is to be checked.
CustomDictionary Optional Variant. Either an expression that returns a Dictionary object or the file name of the custom dictionary.
IgnoreUppercase Optional Variant. True if capitalization is ignored. If this argument is omitted, the current value of the IgnoreUppercase property is used.
AlwaysSuggest Optional Variant. True if Word always suggests alternative spellings. If this argument is omitted, the current value of the SuggestSpellingCorrections property is used.
MainDictionary Optional Variant. Either an expression that returns a Dictionary object or the file name of the main dictionary.
CustomDictionary2 – CustomDictionary10 Optional Variant. Either an expression that returns a Dictionary object or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.
See Also
CheckGrammar method, CheckSynonyms method, IgnoreInternetAndFileAddresses property, ResetIgnoreAll method, SpellingErrorType property.
Example
This example begins a spelling check on all available stories of the active document.
ActiveDocument.CheckSpelling
This example begins a spelling check on section two of MyDocument.doc. The spelling check includes words in all uppercase letters, and it checks words against two custom dictionaries as well as the main dictionary.
Set range2 = Documents("MyDocument.doc").Sections(2).Range
range2.CheckSpelling IgnoreUpperCase:=False, _
CustomDictionary:="MyWork.Dic", _
CustomDictionary2:="MyTechnical.Dic"
This example begins a spelling check on the selection.
Selection.Range.CheckSpelling
This example displays the result of a spelling check on the selection.
pass = Application.CheckSpelling(Word:=Selection.Text)
MsgBox "Selection has no spelling errors: " & pass