none
Different behavior on different version of Outlook RRS feed

  • Question

  • I have simple piece of code which is displaying some reminder to user. Code is working fine in Outlook 2013 but not working on 2007.

    Any idea why ?

    Public WithEvents myOlInspectors As Outlook.Inspectors
    
    Public myInspectorsCollection As New Collection
    
    Private Sub Application_Startup()
    
        Initialize_handler
    
    End Sub
    
    Public Sub Initialize_handler()
    
        Set myOlInspectors = Application.Inspectors
    
    End Sub
    
    Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
    
    If (Inspector.CurrentItem.Class = olMail) Then
    
        If Inspector.CurrentItem.Parent = "Inbox" Then
    
        
    
            strCats = Inspector.CurrentItem.Categories
    
            If InStr(strCats, "Flag") = 0 Then
    
                If Not strCats = vbNullString Then
    
                    strCats = strCats & ","
    
                End If
    
                        QuestionToMessageBox = "Have you tracked the email ?"
    
            YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, " Reminder")
    
            If YesOrNoAnswerToMessageBox = vbNo Then
    
                   MsgBox " Set Regarding"
    
            End If
    
           
    
                strCats = strCats & " Flag"
    
                Inspector.CurrentItem.Categories = strCats
    
                Inspector.CurrentItem.Save
    
            End If
    
        End If
    
    End If
    
    End Sub
    
    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    
        If TypeOf Item Is Outlook.MailItem And Len(Item.Categories) = 0 Then
    
        On Error Resume Next
    
            Set Item = Application.ActiveInspector.CurrentItem
    
            strCats = Item.Categories
    
            If InStr(strCats, " Flag ") = 0 Then
    
                If Not strCats = vbNullString Then
    
                    strCats = strCats & ","
    
                End If
    
                        QuestionToMessageBox = "Have you tracked the email ?"
    
            YesOrNoAnswerToMessageBox = MsgBox(QuestionToMessageBox, vbYesNo, "Reminder")
    
            If YesOrNoAnswerToMessageBox = vbNo Then
    
                MsgBox "Set Regarding"
    
            End If
    
                strCats = strCats & " Regarding"
    
                Item.Categories = strCats
    
                Item.Save
    
            End If
    
            End If
    
    End Sub



    My Dynamics CRM Blog: http://bovoweb.blogspot.com

    Monday, December 3, 2012 11:20 AM

All replies

  • Hi,

    Go to tools - reference - tick Microsoft Outlook 14.0 object library. it works fine in 2007/2010.


    Yogananda

    Monday, December 3, 2012 3:57 PM