none
Spell Check does not work properly in Outlook 2010 RRS feed

  • Question

  • Hi,

    We have an add-in COM which is working fine in outlook 2003 but not in out 2010. The COM has a custom command button. when composing a new email, clicking on this button, it does a spell check of the message first and then asks if the user still want to send the email.

    In outlook 2003, if the spell check could not find any error, the user would see the standard message "The spelling check is complete" first and then our custom confirm message to ask if the user still want to send the email, which is good.

    However, In outlook 2010, if the spell check could not find any error, our custom confirm message popup first, if the user say "No" which they do not want to send the email then the standard message "The spelling check is complete" pop up next, if they say "Yes" then the email is sent and outlook crashed.

    Could someone please help how to make outlook 2010 to pop up the standard message "The spelling check is complete" first?? Below is part of the code.

    Thanks in advance for your help.

    Anh

            Dim objInsp
            Dim colCB
            Dim objCBB
           
            Set objInsp = ActiveInspector
            Set colCB = objInsp.CommandBars
            Set objCBB = colCB.FindControl(1, 2)           
            If Not (objCBB Is Nothing) Then
                If InStr(objCBB.Caption, "Spell") And objCBB.Enabled Then
                    objCBB.Execute
                End If
            End If
            Set objCBB = Nothing
            Set colCB = Nothing
            Set objInsp = Nothing
            Response = MsgBox("This message is about to be sent, do you wish to continue?", 4, "Send and Export")
                        If Response = 6 Then
                           ........

     

     

     

    Thursday, October 27, 2011 11:41 AM

All replies

  • Hi Anh,

     

    Thanks for posting in the MSDN Forum.

     

    I tried to reproduce your issue under Visual Studio 2010 and Office 2010. I can see what you said on my side. As this is a build-in procedure, we are not able to affect it. So we are hard to approach your goal when we put the message box in the snippet which play the sentence “[commandbarcontrol].Execute()”. I guess the main of your goal is prompt the alert to decide whether send the mail for a spell checked document. Is it right? If it is, I would recommend you use the original button on the ribbon tab “Review” and customized your prompter at the mail’s Send event. This is the sample snippet:

     

    Imports Microsoft.Office.Tools.Ribbon
    Imports Word = Microsoft.Office.Interop.Word
    
    Public Class Ribbon1
        Private WithEvents objMail As Outlook.MailItem
    
        Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load
    
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs) Handles Button1.Click
            Dim objInsp As Outlook._Inspector
            Dim objCBB As Object
            Dim se As Outlook.ItemEvents_10_Event
    
            Try
                objInsp = TryCast(Globals.ThisAddIn.Application.ActiveInspector(), Outlook._Inspector)
                objCBB = objInsp.CommandBars.FindControl(1, 2)
                If objCBB IsNot Nothing Then
                    objCBB.Execute()
                End If
    
                objMail = objInsp.CurrentItem
                se = TryCast(objMail, Outlook.ItemEvents_10_Event)
    
                AddHandler se.Send, AddressOf Mail_Send
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
    
        End Sub
    
        Private Sub Mail_Send(ByRef Cancel)
            Dim objInsp As Outlook.Inspector
            Dim document As Word.Document
            Dim Response As Microsoft.VisualBasic.MsgBoxResult
    
            objInsp = Globals.ThisAddIn.Application.ActiveInspector()
            document = objInsp.WordEditor
            If document.SpellingChecked Then
                Response = MsgBox("This message is about to be sent, do you wish to continue?", 4, "Send and Export")
                If Response = 6 Then
                    MsgBox("This is a test")
                ElseIf Response = 7 Then
                    Cancel = True
                End If
            End If
        End Sub
    
    End Class
    


     

     

    I hope it can help you.

     

    Have a good day,

     

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, October 31, 2011 5:34 AM
    Moderator
  • Hi Tom,

    Thank you very much for your response, it is very much appreciated. I will try out your advice but I think it would not work. By somehow Outlook 2010 does not wait for spell check to complete (I mean the final stadnard message box) before executing the next line of code, but it is working fine in Outlook 2003. If you have any other suggestion then I would be very glad to hear.

    Thanks and regards

    Anh

    Tuesday, November 1, 2011 10:03 AM
  • Hi Anh,

    Any update?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, November 8, 2011 10:16 AM
    Moderator