![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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!!! |
Ads |
#2
|
|||
|
|||
![]()
The only thing I can think of is to find the spelling window using something
like FindWindow() and then hook into its Windows message queue. That way you can intercept messages directed at that window and check for mouse clicks and such. How you'd determine all that and how to determine that a click was on the Cancel button is something you'd also have to determine. -- 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 ... 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 |
Display Modes | |
|
|
![]() |
||||
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 |