Represents a single dictionary in active document. Microsoft Word offers another object which is a collection CustomDictionaries holds all custom dictionaries in a document. Custom Dictionary is a reference file which can be used to check spellings in a document against it. Custom Dictionary file identified by “.dic” extension.
- Select File menu
- Select Options command
- Select Proofing tab from the dialog shown below
- Click on Custom Dictionaries button under When correcting spelling in Microsoft Office program group
- Select appropriate dictionary document from the list
Public Sub AddCustomDictionaryExample() CustomDictionaries.Add FileName:="vbaoverall.dic" End Sub
Public Sub FindAllCustomDictionaryExample() 'Object to hold single dictionary Dim oCustomDict As Variant 'Iterate each dictionary For Each oCustomDict In CustomDictionaries Debug.Print oCustomDict.Name Next oCustomDict 'Cleanup If Not oCustomDict Is Nothing Then Set oCustomDict = Nothing End If End Sub
Public Sub ClearAllCustomDictionariesExample() CustomDictionaries.ClearAll End Sub
Note: ClearAll method doesn’t delete the custom dictionary rather it disable the dictionary by unchecking from the list as shown above.
Next >> Copy Entire Document to another Document Word VBA