how to disable spell checker

A

Allen_N

I have built an Excel utility that fetches e-mail addresses from a database
of users and e-mails a prepared message (from a text box in a worksheet) to
some or all of the addresses. The e-mail addresses are fetched by a query and
populate a column in a worksheet. When all are to be e-mailed, I build the
recipient list from the column cells and call ShellExecute/mailto once. When
only selected addresses are to be e-mailed, I call ShellExecute/mailto in a
loop, so that the messages can be individually customised in the Outlook
composer window.

My only problem is that, in the latter mode, the Outlook spell checker is
invoked each time a new message/recipient is created.

Is it possible to programmatically disable Outlook's spell checker (from
Excel VBA), then re-enable it when done?

Thanks!

Al
 
K

Ken Slovak - [MVP - Outlook]

The setting for spell checking is in the registry. Outlook reads the setting
on startup, then caches the setting and any changes in memory while Outlook
is running. If you change the Options dialog to disable spell check on send
Outlook writes the change to the registry but still relies on the in-memory
cached setting for its operations. So any change you make needs to be when
Outlook is not running.

The registry location is at
HKCU\Software\Microsoft\Office\11.0\Outlook\Options\Spelling, in the
registry value Check (a REG_DWORD value). 1 means spell check is enabled, 0
means it's disabled.

That registry path is specific to Outlook 2003, for 2007 it would be "12.0"
instead of "11.0", etc.
 
A

Allen_N

Thanks, Ken.

I don't think I want to start programmatically altering Registry keys --
especially if I'm going to share the app with other people in the company.

Is there a way to detect whether or not the spell checker process runs after
invoking Outlook from ShellExecute? If I could do that, I could use SendKeys
to dismiss the spell checker pop-up and carry on with the mailing loop.

Regards,
Al
 
K

Ken Slovak - [MVP - Outlook]

The only way I know of to do that is to use Win32 API calls to find the
spelling window class and then send a Windows Message to that window to
close down. You'd have to use Spy++ or a similar utility to find the
spelling window class name and use that in calls to something like
FindWindow() or FindWindowEx(). Then a SendOrPost to that window with
WM_CLOSE as the message should do it.
 
A

Allen_N

Thanks again, Ken !



Ken Slovak - said:
The only way I know of to do that is to use Win32 API calls to find the
spelling window class and then send a Windows Message to that window to
close down. You'd have to use Spy++ or a similar utility to find the
spelling window class name and use that in calls to something like
FindWindow() or FindWindowEx(). Then a SendOrPost to that window with
WM_CLOSE as the message should do it.
 

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