A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Automate Spell Check on MailItem.Send() ???



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old March 30th 07, 04:44 AM posted to microsoft.public.outlook.program_addins
Brian McCullough
external usenet poster
 
Posts: 10
Default Automate Spell Check on MailItem.Send() ???

Hello,

I have inherited an Outlook Addin which is currently working for Outlook XP.
The current add in is really simple. It adds a custom button to the
"Standard" toolbar for a MailItem's Inspector and, when clicked, this button
modifies the email message slightly and then sends it. The problem is, the
code use's the MailItem's .Send() method to send the message and, because
many of the users in the company use Outlook's editors (i.e. RichText or
HTML) to create the email messages, the Spell Checker is not launched when
the message is sent (even if the appropriate settings have been configured
in the Tools Options Spelling tab).

I have been asked to get some sort of spell checking to work with this
addin. The addin is written in vb.net and I have access to the Redemption
library.

After attempting a few solutions using Word as the "spell check hosting
engine" (as in this MSDN article:
http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx) and
automating the "click" of the regular Send button, I have been unsuccessful.

I am really close using something where I automate the "click" of the
Inspector's Tools Spelling command (looks similar to this):


Private Sub HandleMyButton()

Dim objMailItem as MailItem 'this is set and initialized up top

'checks in place to check for Word mail up here...the rest assumes Outlook
mail editor

Dim ctlSpellCheck As CommandBarControl
Dim cbrMenuBar As CommandBar

Set cbrMenuBar = m_objInsp.CommandBars("Standard")

'i know there is a better way to get this control, but I havent downloaded
Outlook Spy again to verify the ID of the Spelling menu item
Dim ctlTmp As CommandBarControl
For Each ctlTmp In cbrMenuBar.Controls
If ctlTmp.Type = msoControlButton Then
If ctlTmp.Caption = "&Spelling..." Then
Set ctlSpellCheck = ctlTmp
Exit For
End If
End If
Next

'a "Spell Check has Completed" message box is shown after Outlooks Spell
Checker has run and NOT BEEN CANCELED...
ctlSpellCheck.Execute

objMailItem.Subject = "MODIFIED MESSAGE" & objMailItem.Subject

objMailItem.Send()

End Sub


There are a few minor problems with this...

1. When I use the Spelling menu item's Execute method, the spell checking
runs fine, but after the spell check has been completed (not canceled), I
get a message stating along the lines of "The spell check has completed".
This same message that you see after spell checking has completed during
regular spell checking functionality (i.e. if you choose Tools Spelling
menu item on the message yourself). This message isnt shown if I were to
click the regular "Send" button.

2. The spell checking dialog has a "Cancel" button on it, but when I click
this button, I have no way of handling this condition. One thing I do know
is that I don't get the message dialog from #1 above. When I click the
Cancel button, the code just keeps on going and sends the message. However,
when I press Cancel, I'd like to be able to handle this

Is there ANY way possible to determine if the user clicked the "Cancel"
button during the spell check? For example, can I write some low level code
that can hook into the spell check window shown by Outlook? Perhaps there
is a Win32 API method that I could use to determine if the dialog in #1
above was shown, which would indicate that the user did NOT cancel the spell
check??? I know it's a long shot, but I wanted to see if anyone had any
ideas on this...

TIA!!!


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell check dialog box scrolls to the bottom Spell check dialog box scrolls to the bottom repeatedly, Tom Tessier Outlook Express 7 November 11th 06 03:31 PM
Outlook express can't spell check. It says to check later. Harold Outlook - General Queries 2 September 8th 06 10:56 PM
Spell Check chathp Outlook Express 3 September 7th 06 08:49 PM
Spell Check Max Outlook Express 6 July 15th 06 03:13 PM
spell check buss Outlook Express 1 April 26th 06 12:01 AM


All times are GMT +1. The time now is 07:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.