Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word - VBA code to add entries to custom dictionary

Status
Not open for further replies.

MakeItSo

Programmer
Oct 21, 2003
3,316
DE
Hi friends,

Me again with extravagant desires: :p

I would like to check a great number of word documents on their correct and consistent use of certain technical terms.
Although this cannot be done without a linguist actually checking this, I'd like to identify great parts in a first run automatically.

I thought of a custom dictionary containing all approved terms together with a custom thesaurus dictionary containing all unwanted variants of these terms.
Then, via spell checking, I should be able to detect where in the document unapproved terminologie has been used instead of the correct term.

However, i don't know how to programmatically add dictionary entries, e.g. from a database.

Do you have any idea how this can be done?

Do you have perchance some other suggestions on how to solve this?

:)
Thanks in advance,
Andy

[blue]Help us, join us, participate
IAHRA - International Alliance of Human Rights Advocates[/blue]
 
Hmm, no one has an idea yet?

I feared so. It seems, that custom dictionaries are not comparable to the original Word spell checking dictionary, which is a binary ".lex" file, whilst a custom dictionary is a plain text ".dic" file, and nothing more than a list of words without any reference to a thesaurus or information on whether it's a verb, noun, adjective....
[sadeyes]

I think, I'll have to program my own lookup function, using the database directly, scanning the doc via Word's search function.

Too bad. I thought I could use some built-in Word functionality to make it speedy - and especially: less dependent on extra files!

If you have any suggestions, I'm always keeping an ear open for them, no matter how this post will become!
:)

Cheers,
Andy

[blue]Help us, join us, participate
IAHRA - International Alliance of Human Rights Advocates[/blue]
 
Hi Andy,

I don't know how, or whether, you can amend or create lex files but the plain text custom and exclude dictionaries are, as you say, just text files so programmatically manipulating them is relatively easy. Where are you getting the words from or, more importantly perhaps, how are you getting them. Do you have a particular need to do this from Word, or dynamically in any way?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

Professional Office Developers Association
 
Hi Gerry, Tony.

The reason why i want to do it in Word is simple: the files I want to check are Word documents.

I am getting the words from an MDB. Originally, they are in an excel sheet, which I have imported into Access.

Of course it is relatively easy to add the entries to the dictionary, but that won't solve my problem.
The main problem is, that there have been many synonyms used instead of the correct terms in the past.
Now I want to program some sort of QA tool, that will allow the linguistic reviewer to perform a custom spell check to
a) find the synonyms in the files
b) have the tool propose the approved term
c) detect synonyms and approved terms with typos.

I thought that the spell checking function of word would provide me with a very potent tool, that includes spell checking, correction suggestions AND a thesaurus.

Too bad: both the underlying LEX and the thesaurus attributes and entries are read-only from VBA.

I am now thinking of doing it in two steps, using the custom dictionary for spell checking only, and query the database for the use of synonmys.
This will surely be essentially slower than the Word functionality, but I have no idea how else to achieve this.

For future documents, the problem of typos with approved terms shall already reduce to a minimum, due to some templates I've created, with the different approved glossaries as Auto-Text entries, which you can activate for authoring.

Thanks for your feedback!

Cheers,
Andy

[blue]Help us, join us, participate
IAHRA - International Alliance of Human Rights Advocates[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top