View Single Post
  #5  
Old April 2nd 07, 05:09 PM posted to microsoft.public.outlook.program_addins
Brian McCullough
external usenet poster
 
Posts: 10
Default Outlook 2007 Spell Checking?

OK..I will try that tomorrow (heading out of the office for today), but one
question that maybe you can answer before I have to test for it...Does the
call to CheckSpelling initiate the user interface for the spell checker, or
does this method only call the method that returns a ProofreadingErrors
collection (or similar type of collection) that I would programatically have
to handle?

Thanks!!

-Brian



"Ken Slovak - [MVP - Outlook]" wrote in message
...
Actually the subset of Word that's used as the email editor is used
whether or not the full Word 2007 is installed. You do get more
functionality if you were to use the Word object model if Word is
installed, but the end result is no more Outlook email editor.

You can force a spell check using code. The presumption is that when using
code to send items that no user interaction is required or wanted, so
normally the spell check will not run.

However, if you get a handle to the email's Inspector you can get the
WordEditor object, which is a Word.Document object. You then can use the
Document.CheckSpelling() method to force a spell check before you send the
email using code. You have to save the email first before you send it.

Here's a quickie VBA sample of how to do that:

Sub SpellIt()
Dim oMail As Outlook.MailItem
Dim oDoc As Word.Document

Set oMail = Application.ActiveInspector.CurrentItem
Set oDoc = Application.ActiveInspector.WordEditor

oMail.Save 'save the item so it is in the Outlook data store

oDoc.CheckSpelling

oMail.Save 'persist any spelling changes

oMail.Send
End Sub

You can also call the grammar checker the same way.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Brian McCullough" wrote in message
...
Ken,

Thanks for your response.

I have read that in Outlook 2007, Word is used as the email editor, even
if you haven't installed Word. If Word is not installed, a subset of it
is installed in order to compose email messages. I understand they
wanted to get rid of the Outlook email editor so that they (Office
Development Team) didn't have to maintain two codebases.

When using Word as the email editor for Outlook 2002 (Office XP), when
you write code using the MailItem.Send() method, and you have the "Always
check spelling before sending" option selected in Outlook, the Word spell
checker is launched (it is not if you use Oulook as the email editor).

It looks like in Outlook 2007, if you have the same code executing (i.e.
MailItem.Send()), the spell checker is NOT launched (eventhough Word is
the email editing program - since there is no more "Outlook editor").

My question is, how are we to make sure that spell checking gets run
(using the provided spell checking tools - not custom tools) if we are
automating the send action of the email ??? In my scenario, I have an
addin in which a "Custom Send" button is added to the Standard toolbar
(in 2007, it is loaded to the "Add-Ins" tab. This "Custom Send" button
modifies the message only slightly, then uses the MailItem.Send method to
send the message. When the message is sent, I'd like any normal
pre-processing of the message, such as spell checking (if the option is
selected) to run. Is there a way in 2007 to get the Send action to occur
with all the "normal" send rules? For example, perhaps with the new
security model in place, we can now automate the click of the "Send"
button on the mail item's inspector?

From an end user standpoint, if they have checked that spell checking
always be run, then it should run when they initiate a "send" action.
And it seems to me that this is pretty common funnctionality being asked
for. I have seen similar posts for Outlook 2002 and 2003 posted over the
last few years.

I understand that someone could be writing code that automates the send
action without any user interaction - for exmaple as a windows service,
in which case you wouldn't want a spell checking dialog displayed, but in
the case where a user is interacting with the message, we should have the
ability to make sure all the normal "send" processing occurs.

If there is no way in 2007 to do this, is there a way to funnel this up
to the Office Development Team to see that they expose this functionality
in a later release or service pack?

TIA!!!

Brian




Ads