Word Object Library / Spelling Checker

N

Norrie

Hi,
I am currently developing a project which involves the storage/retrieval of
Word documents to/from a SQL Server database.
The user is required to be able to select a document from a list of stored
documents and press a button which should extract the relevant document from
the database and open it within Word to allow the document to be edited.
The problem that I am currently experiencing is that once the document has
been launched within Word, the "Check spelling as you type" option is
checked, but word acts as if this option was switched off.
Below is a snippet of code used to launch the document:

Public Sub OpenDocument(sFileName As String)
Dim oWord As Word.Application
Dim oDoc As Word.Document

Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Open(sFileName)
oDoc.Activate
oWord.Visible = True
oWord.Activate
End Sub

Any help in this matter would be greatly appreciated as it is slowly driving
me mad.

Cheers,
Norrie
 
D

Doug Robbins - Word MVP

Maybe you need to add a line

ODoc.Range.NoProofing = False

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
N

Norrie

Hi Doug,
Firstly i'd like to thank you for your reply to my question.
I tried your solution without any success. The original document that i am
currently working on in a test basis contained words that are not present
within the current dictionary (e.g. (Hons)) and adding this additional line
resulted in these words not being underlined in red. Also my original
problem whereby newly added text was not being underlined if mis-spelled
still persists.
I noticed by chance that if i put a break-point on the line that reads
"oDoc.Activate" to stop program execution, then resume execution from this
point that the problems all seem to clear-up and words acts as i would
expect. With this in mind, i tried to place a pause in the code prior to
this line (unsing the API Sleep function), but unfortunately this had no
effect.
Thanks again,
Norrie.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?Tm9ycmll?=,
I am currently developing a project which involves the storage/retrieval of
Word documents to/from a SQL Server database.
The user is required to be able to select a document from a list of stored
documents and press a button which should extract the relevant document from
the database and open it within Word to allow the document to be edited.
The problem that I am currently experiencing is that once the document has
been launched within Word, the "Check spelling as you type" option is
checked, but word acts as if this option was switched off.
How about if you toggle the option off and back on to "give it a kick"? Or if
you trigger the "Recheck" functionality?

The check spelling as you type can get locked out. One reproducible way is if a
file contains too many spelling errors. Other than that, it just seems to have
something to do with the state of the document at some critical juncture. It's
usually possible (in the UI, anyway) to get it back doing something or other in
the options, or by running a full check.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
N

Norrie

Hi Cindy,
Thank you for your response to my problem.
Unfortunately I had already tried the "switch it off, then back on again"
approach, which did not solve the problem.
Whilst experimenting farther, i found a solution (not very elegant but seems
to work). The solution that i found was to force word to activate its
spell-checker by adding the line 'oWord.CheckSpelling ("a")' directly after
the document was opened.
Thank you again for your response,
Norrie.
 

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