Add a word to (custom) dictionary

  • Thread starter Andrew Fiddian-Green
  • Start date
A

Andrew Fiddian-Green

The Word Dictionary object comes in two flavours: 1) "read only"
dictionaries (based on .lex files) and 2) "non read only" dictionaries
(based on .dic files).

Indeed in Word automation you can check if a dictionary is "read only" by
means of the respective ReadOnly property.

But -- here is the mystery -- even if Dictionary.ReadOnly = false, it seems
that there is absolutely nothing that you can actually do to write a new
word into the dictionary! (or delete an existing word from it)i.e. there are
no AddWord or DeleteWord methods...

Questions:

1. Am I right or am I wrong?
2. Is there a work around for adding words to a "non read only" dictionary?
3. If not, then why on earth does Microsoft bother to publish a totally
useless ReadOnly property??

Regards,
AndrewFG
 
H

Helmut Weber

Hi Andrew,

a user dictionary is nothing but an ordinary text-file.
It's faster to code it yourself then searching
for a ready to use VBA-method:

Add a word:

Open "c:\test\test.dic" For Append As #1
Write #1, trim(Selection.Words(1))
Close 1

Somewhat simplified, though.

Need help on deleting, checking whether already
in the dictionary?

Ask again.

Greetings from Bavaria, Germany

Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 
A

Andrew Fiddian-Green

Yes, thanks, but I worked that out myself already.

Now, all I need to know is how to how to hook up to the custom dictionary
when using wordDocument.Range.SpellingErrors and
wordDocument.Range.GetSpellingSuggestions...

Regards,
AndrewFG
 
H

Helmut Weber

Hi,
Now, all I need to know is how to how to hook
up to the custom dictionary

Maybe it's my English.
Do you wnat to now how to activate a custom dictionary?
CustomDictionaries.Add ("C:\dic\user.dic")
Doesn't matter whether activating it several times,
whithout deactivating it again.
Though I didn't find a straight way to deactivate
a custom dictionary, but only workaraounds.

Or are you looking for:

CustomDictionaries.Count
CustomDictionaries(1).name
CustomDictionaries(1).path

etc.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 

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