Dictionaries Collection Object

Word Developer Reference

A collection of Dictionary objects that includes the active custom spelling dictionaries.

Remarks

Use the CustomDictionaries property to return the collection of currently active custom dictionaries. The following example displays the names of all the active custom dictionaries.

Visual Basic for Applications
  For Each d In CustomDictionaries
    Msgbox d.Name
Next d

Use the Add method to add a new custom dictionary to the collection of active custom dictionaries. If there isn't a file with the name specified by FileName, Word creates it. The following example adds "MyCustom.dic" to the collection of custom dictionaries.

Visual Basic for Applications
  CustomDictionaries.Add FileName:="MyCustom.dic"

Use the ClearAll method to unload all custom dictionaries. Note, however, that this method doesn't delete the dictionary files. After you use this method, the number of custom dictionaries in the collection is 0 (zero). The following example clears the custom dictionaries and creates a new custom dictionary file. The new dictionary is set as the active custom dictionary, to which Word will automatically add any new words it encounters.

Visual Basic for Applications
  With CustomDictionaries
    .ClearAll
    .Add FileName:= "MyCustom.dic"
    .ActiveCustomDictionary = CustomDictionaries(1)
End With

Remarks

You set the custom dictionary to which new words are added by using the ActiveCustomDictionary property. If you try to set this property to a dictionary that isn't a custom dictionary, an error occurs.

The Maximum property returns the maximum number of simultaneous custom spelling dictionaries that the application can support. For Word, this maximum is 10.

See Also