A family of Microsoft word processing software products for creating web, email, and print documents.
Greg, OK. I got it figured out. Once I deleted the line with the clear all, it works perfectly as well as my original code works as well
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using Word 2019. I am using the following code to assign a custom dictionary:
Private Sub Document_Open()
With CustomDictionaries
.ClearAll
.Add FileName:="C:\GBL\EProject\Plants\Plants.dic"
.ActiveCustomDictionary = CustomDictionaries(1)
End With
End Sub
However when I open the document it does not recognize the custom dictionary. I have to go in through the options button to highlight the custon dictionary in proofing.
How can I do this with code when opening the document
My e-mail is ******@verizon.net
Thanks
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Greg, OK. I got it figured out. Once I deleted the line with the clear all, it works perfectly as well as my original code works as well
Answer accepted by question author
Here is the example in VBA documentation:
Dim dicCustom As Dictionary
Application.CustomDictionaries.ClearAll
Set dicCustom = Application.CustomDictionaries _
.Add(FileName:="C:\Program Files" _
& "\Microsoft Office\Office\Home.dic")
Application.CustomDictionaries.ActiveCustomDictionary = dicCustom
Sorry, it now doesn't seem to work. I closed and opened the document and it wouldn't work. I had the same problem I had to go in to the proofing to highlight the dictionary to get it to accept new words. I changed the code to the following to fit my scheme:
Private Sub Document_Open()
Dim dicCustom As Dictionary
Application.CustomDictionaries.ClearAll
Set dicCustom = Application.CustomDictionaries _
.Add(FileName:="C:\GBL\EProject\Plants\Plants.dic")
Application.CustomDictionaries.ActiveCustomDictionary = dicCustom
End Sub
Like before it made my custom dictionary the default but would allow me to use it until I highlighted it in the custom dictionary dialog box
Thanks Greg. It seems to work I appreciate the help.
I consider myself a power vb user in Excel and Access but never really got into Word. Maybe I am not looking in the right places but I am having a hard time finding info on VB and word. It seems to be scarce.
I looked at your sight and found it very helpful. Thank you again
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more