Microsoft Word Custom Dictionary with code example

Microsoft Word Custom Dictionary with code example


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 dictionary

  1. Select File menu
  2. Select Options command
  3. Select Proofing tab from the dialog shown below
  4. Click on Custom Dictionaries button under When correcting spelling in Microsoft Office program group
  5. Select appropriate dictionary document from the list

Add method

Public Sub AddCustomDictionaryExample()
    CustomDictionaries.Add FileName:="vbaoverall.dic"
End Sub


Name property

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
    If Not oCustomDict Is Nothing Then
        Set oCustomDict = Nothing
    End If
End Sub



ClearAll method

Public Sub ClearAllCustomDictionariesExample()
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

Leave a Reply

Your email address will not be published. Required fields are marked *