Language Object
Description
Represents a language used for proofing or formatting in Word. The Language object is a member of the Languages collection.
Using the Language Object
Use Languages(index), where index is either a name or one of the WdLanguageID constants, to return a single Language object.
The Name property returns the name of a language, whereas the NameLocal property returns the name of a language in the language of the user. The following example returns the string "Italiano" for Name and "Italian (Standard)" for NameLocal when it's run in the U.S. English version of Word.
Msgbox Languages(wdItalian).Name
Msgbox Languages(wdItalian).NameLocal
Returning the Active Proofing Dictionaries
For each language for which proofing tools are installed, you can use the ActiveGrammarDictionary, ActiveHyphenationDictionary, ActiveSpellingDictionary, and ActiveThesaurusDictionary properties to return the corresponding Dictionary objects. The following example returns the full path for the active spelling dictionary used in the U.S. English version of Word.
Set myspell = Languages(wdEnglishUS).ActiveSpellingDictionary
MsgBox mySpell.Path & Application.PathSeparator & mySpell.Name
Setting the Writing Style
The writing style is the set of rules used by the grammar checker. The WritingStyleList property returns an array of strings that represent the available writing styles for the specified language. The following example returns the list of writing styles for U.S. English.
WrStyles = Languages(wdEnglishUS).WritingStyleList
For i = 1 To UBound(WrStyles)
MsgBox WrStyles(i)
Next i
Use the DefaultWritingStyle property to set the default writing style you want Word to use.
Languages(wdEnglishUS).DefaultWritingStyle = "Casual"
You can override the default writing style with the ActiveWritingStyle property. This property is applied to a specified document for text marked in a specified language. The following example sets the writing style to be used for checking U.S. English, French, and German for the active document.
With ActiveDocument
.ActiveWritingStyle(wdEnglishUS) = "Technical"
.ActiveWritingStyle(wdFrench) = "Commercial"
.ActiveWritingStyle(wdGerman) = "Technisch/Wiss"
End With
Remarks
You must have the proofing tools installed for each language you intend to check. You need both a .dll file and an .lex file for each of the following: the thesaurus, spelling checker, grammar checker, and hyphenation tools.
If you mark text as wdNoProofing, Word skips the marked text when running a spelling or grammar check. To mark text for a specified language or for no proofing, use the Set Language command (Tools menu, Language submenu).
Properties
ActiveGrammarDictionary property, ActiveHyphenationDictionary property, ActiveSpellingDictionary property, ActiveThesaurusDictionary property, Application property, Creator property, DefaultWritingStyle property, ID property, Name property, NameLocal property, Parent property, SpellingDictionaryType property, WritingStyleList property.
See Also
LanguageID property.