Word 2007: Custom Dictionary stays in list after Dictionary.Delete

J

Julian Ladbury

I want to create and add a Custom Dictionary when my document opens, then
delete it when it closes. All works fine in Word XP and 2003, but not in 2007
and 2010 beta.

This is the code I have used to investigate the problem I have found:

' dictionary is created before this bit of code runs

Dim dictionaryName As String
dictionaryName = "C:\Documents and Settings\Lenny\Application
Data\Microsoft\UProof\Test.dic" ' Word 2007, Windows XP
' "C:\Documents and Settings\Lenny\Application
Data\Microsoft\Proof\Test.dic" ' Word XP or 2003, Windows XP
CustomDictionaries.Add dictionaryName
CustomDictionaries(dictionaryName).Delete
Kill dictionaryName

In Word XP and Word 2003, all works as expected. By the time the code
finishes, there is no trace of the dictionary in the list at Tools > Options
Spelling and Grammar > Custom Dictionaries.

In Word 2007 and Word 2010 beta the custom dictionary remains in the list in
Word Options > Proofing > Custom Dictionaries, albeit unchecked.

I have stepped through the code and find that in all versions the dictionary
becomes unchecked in the list after the
'CustomDictionaries(dictionaryName).Delete' statement. in In Word XP and 2003
it is removed from the list after the 'Kill dictionaryName' statement, but
that is not the case with 2007 or 2010 beta.
 
C

Colbert Zhou [MSFT]

Hello Julian,

Thanks for your posting! I am sorry for following up late on the thread.
Actually I was on leave in the last 3 days for Chinese Spring Festival. I
just read this post and I am trying to reproduce it and investigate. I will
update as soon as possible.


Best regards,
Ji Zhou
Microsoft Online Community Support
 
C

Colbert Zhou [MSFT]

Hello Julian,

Based on my researches, the followings are my founds,

The Kill statement is used to delete files in VBA language. I did not have
a Word 2003 to test, but from your description, it seems, as long as the
dictionary file is deleted from the system, then the custom dictionary is
removed from the list in Word XP and 2003.

I test in my Word 2007 and Word 2010 beta2. I can see the issue you
mentioned. After some investigations, I found Word uses some values in
registry key,
"HKCU\Software\Microsoft\Shared Tools\Proofing Tools\1.0\Custom
Dictionaries"
to control the dictionaries list in Word.

Each dictionary entry are mapped to two values. In my side,
1 MyDic.DIC (Dictionary Name)
1_state 01 (Dictionary State)

You can verify this registry key in your side. So my suggestion is if we
want to remove a custom dictionary from the list in Word option, we need to
delete two corresponding values from that registry key using VBA codes.

Hope this helps and wish you a good day! :)

Best regards,
Ji Zhou
Microsoft Online Community Support
 
J

Julian Ladbury

Hi Colbert,

No problem with the slow reply, I have been away myself. Thanks for your
input.

Following further problems with adding and deleting dictionaries I decided
that the user benefit was not worth the coding effort and am hence happy not
to pursue this any more. However, I would suggest that the Office team should
a) be made aware of this undocumented change in behaviour bewteen releases
and b) update the documentation appropriately where possible to avoid others
having to tread the same path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top