Need to have script identify new mail items to run RRS feed

  • Question

  • I have the following code that i used to help set up a custom follow up flag/date/hour for my emails and it will run perfectly fine if i press f5 to make it run in outlook:             

    Function GetCurrentItem() As Object

        Dim objApp As Outlook.Application

        Set objApp = Application
        On Error Resume Next
        Select Case TypeName(objApp.ActiveWindow)
            Case "Explorer"
                Set GetCurrentItem = objApp.ActiveExplorer.Selection.item(1)
            Case "Inspector"
                Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
        End Select

        Set objApp = Nothing
    End Function

    Sub CustomMailMessageRule(item As Outlook.MailItem)

    End Sub

    Public Sub SetCustomFlag()

    Dim objMsg As Object

    ' GetCurrent Item function is at
    Set objMsg = GetCurrentItem()

    With objMsg

    ' due this week flag
        .MarkAsTask olMarkThisToday
    ' sets a specific due date
        .TaskDueDate = Now + 1

        .FlagRequest = "Call " & objMsg.SenderName
        .ReminderSet = True
        .ReminderTime = Now + 1
    End With

    Set objMsg = Nothing
    End Sub

    what I would LIKE to do is have this script automatically detect any NEW emails that come into my inbox using the following Rule in outlook:                                                                                                                                                               Apply this rule after the message arrives, with Specific words in the subject, run a script (script above)                              can ANYONE please help me with this.  im still new to this but ANY help will be appreciated!!!

    Thursday, September 26, 2013 7:32 PM