Class Dictionary (Word VBA)

The class Dictionary represents a dictionary. Dictionary objects that represent custom dictionaries are members of the Dictionaries collection. Other dictionary objects are returned by properties of the Languages collection; these include the ActiveSpellingDictionary, ActiveGrammarDictionary, ActiveThesaurusDictionary, and ActiveHyphenationDictionary properties.

The main procedures of class Dictionary are Dictionaries.Add, Delete and HangulHanjaConversionDictionaries.Add

Set

To use a Dictionary class variable it first needs to be instantiated, for example

Dim dict as Dictionary
Set dict = CustomDictionaries(Index:=1)

The following procedures can be used to set variables of type Dictionary: Application.CustomDictionaries, Dictionaries.Add, Dictionaries.Item, Dictionaries.ActiveCustomDictionary, HangulHanjaConversionDictionaries.Add, HangulHanjaConversionDictionaries.Item, HangulHanjaConversionDictionaries.ActiveCustomDictionary, Language.ActiveGrammarDictionary, Language.ActiveHyphenationDictionary, Language.ActiveSpellingDictionary, Language.ActiveThesaurusDictionary and Application.HangulHanjaDictionaries

For Each

Here is an example of processing the Dictionary items in a collection.

Dim dictCustomDictionary As Dictionary
For Each dictCustomDictionary In CustomDictionaries
	
Next dictCustomDictionary

Themes

The following procedures in this class have been grouped together and are described on a separate theme page

Add with its procedures Dictionaries.Add and HangulHanjaConversionDictionaries.Add

Methods

These are the main methods of the Dictionary class

Delete - Deletes the specified dictionary.

CustomDictionaries(1).Delete

Properties

Dictionaries.ActiveCustomDictionary returns or sets a Dictionary object that represents the custom dictionary to which words will be added.

CustomDictionaries.ActiveCustomDictionary =

Dictionaries.Count returns a Long that represents the number of dictionaries in the collection.

Dim lngCount As Long
lngCount = CustomDictionaries.Count

Dictionaries.Maximum returns the maximum number of custom or conversion dictionaries allowed.

Dim lngMaximum As Long
lngMaximum = CustomDictionaries.Maximum

Dictionaries.Parent returns an object that represents the parent object of the specified Dictionaries object.

Dim objParent As Object
Set objParent = CustomDictionaries.Parent

LanguageID returns or sets a WdLanguageID constant that represents the language for the specified object.

CustomDictionaries(1).LanguageID = wdAfrikaans

LanguageSpecific true if the custom dictionary is to be used only with text formatted for a specific language.

CustomDictionaries(1).LanguageSpecific = True

Name returns the name of the specified object.

Dim strName As String
strName = CustomDictionaries(1).Name

Parent returns an object that represents the parent object of the specified Dictionary object.

Dim objParent As Object
Set objParent = CustomDictionaries(1).Parent

Path returns the path to the specified dictionary.

Dim strPath As String
strPath = CustomDictionaries(1).Path

ReadOnly true if the specified dictionary cannot be changed.

Dim booReadOnly As Boolean
booReadOnly = CustomDictionaries(1).ReadOnly

Type returns the dictionary type.

Dim wdtType As WdDictionaryType
wdtType = CustomDictionaries(1).Type

HangulHanjaConversionDictionaries.ActiveCustomDictionary returns or sets a Dictionary object that represents the custom dictionary to which words will be added.

HangulHanjaDictionaries.ActiveCustomDictionary =

HangulHanjaConversionDictionaries.Count returns a Long that represents the number of dictionaries in the collection.

Dim lngCount As Long
lngCount = HangulHanjaDictionaries.Count

HangulHanjaConversionDictionaries.Maximum returns the maximum number of custom or conversion dictionaries allowed.

Dim lngMaximum As Long
lngMaximum = HangulHanjaDictionaries.Maximum

HangulHanjaConversionDictionaries.Parent returns an object that represents the parent object of the specified HangulHanjaConversionDictionaries object.

Dim objParent As Object
Set objParent = HangulHanjaDictionaries.Parent