VBA & Macro Problems

How to Assign a Custom Word Dictionary with VBA at Startup

Amos GikundaAmos Gikunda Nov 2, 2026 869 views

Question details

The user needs to assign a custom spelling dictionary using a Word VBA macro when a document opens, but clearing existing dictionaries prevents the new one from functioning automatically.

How to Assign a Custom Word Dictionary with VBA at Startup
Product
Microsoft Word
Device & OS
not provided
Scenario
Running a Document_Open VBA macro to set a specific custom dictionary (.dic) for spell checking upon opening a file.
Observed behavior
Using CustomDictionaries.ClearAll before adding the new dictionary causes Word to ignore the newly added dictionary, requiring the user to manually select it in the Custom Dictionaries dialog before it works.
Before you start

Before editing your VBA macros, ensure you have the exact file path to your custom dictionary (.dic) file and back up your current Word document containing the macro code.

Solution 1Recommended

Add and Activate the Dictionary Directly Without ClearAll

Skip clearing all custom dictionaries to prevent Word from unlinking the active dictionary functionality, and simply assign the new dictionary directly in the Document_Open event.

The CustomDictionaries.ClearAll method can sometimes detach Word's internal spell-check engine from recognizing newly added dictionaries programmatically. By removing this command, the new dictionary integrates seamlessly.

1
Open the VBA Editor

Press Alt + F11 in Word to open the Visual Basic for Applications (VBA) editor, and locate your Document_Open event.

2
Remove the ClearAll Command

Find and delete or comment out the line that says 'Application.CustomDictionaries.ClearAll'.

3
Add the Custom Dictionary

Add your dictionary explicitly using the syntax: Set dicCustom = Application.CustomDictionaries.Add("C:\Path\To\Your.dic").

4
Set as Active Dictionary

Force Word to use it as the default by adding: Application.CustomDictionaries.ActiveCustomDictionary = dicCustom.

5
Test the Document

Save your macro, close the editor, and reopen the document. Type a deliberate spelling error to verify that the custom dictionary is actively checking spelling.

Add and Activate the Dictionary Directly Without ClearAll
Macro Testing: By avoiding the ClearAll command, Word retains the necessary internal references to utilize the custom dictionary immediately upon document startup.
Free Microsoft Office alternative

Try WPS Office for Seamless Word Processing

Dealing with complex VBA macro issues and dictionary bindings in Microsoft Word can disrupt your workflow. WPS Office offers a free, lightweight, and highly compatible alternative with an intuitive interface, making document creation, proofing, and editing straightforward and stress-free.

Free and lightweight complete office suiteExcellent compatibility with Microsoft Word (.docx) formats and filesFamiliar user interface for a zero-learning-curve transitionBuilt-in robust spell check and formatting tools without requiring complex macro setups
microsoft office alternative - wps office

Frequently Asked Questions

Why does CustomDictionaries.ClearAll stop Word from using my new dictionary?

Using ClearAll removes all references to custom dictionaries in Word's registry and application settings. Sometimes, adding a new dictionary immediately after a ClearAll command fails to trigger Word's internal spell-check engine to actively use it until the dictionary list is manually refreshed in the Options menu.

How do I manually check my active custom dictionary in Word?

Go to File > Options > Proofing, and click on 'Custom Dictionaries'. Here you can see which dictionaries are currently loaded, verify the file paths, and ensure the checkbox next to your custom dictionary is selected.

What is the correct VBA syntax to add a custom dictionary?

You should use the Add method combined with the full file path. The standard syntax is: Application.CustomDictionaries.Add(FileName:="C:\YourDirectory\YourDictionary.dic").

Does WPS Office support VBA macros?

Yes, WPS Office supports macros (WPS Macro) and provides an environment similar to VBA, though highly specific Microsoft Office object model scripts may require minor adjustments depending on the functions used.