I always forget to follow up on promises I make in mails I send, so I wrote some VBA code to inspect all outgoing mails for certain key phrases. If one of them is found, Outlook will ask if it should mark the mail as a task and set a reminder on it.

Dim WithEvents mcolSentMailItems As Items
Dim objNS As NameSpace
Private Sub Application_Startup()
    Set objNS = Application.GetNamespace("MAPI")
    Set mcolSentMailItems = objNS.GetDefaultFolder(olFolderSentMail).Items
End Sub
Private Sub mcolSentMailItems_ItemAdd(ByVal Item As Object)
    ' Get the content of the mail
    strReplyPart = Item.Body
    ' Remove everything from my signature onwards, to remove text containing other people's promises
    If InStr(strReplyPart, "Best regards") > 0 Then strReplyPart = Left(strReplyPart, InStr(strReplyPart, "Best regards") - 1)

    ' Check for a promise
    If _
        InStr(1, strReplyPart, "I will ", vbTextCompare) > 0 _
        Or InStr(1, strReplyPart, "I shall ", vbTextCompare) > 0 _
        Or InStr(1, strReplyPart, "Let me check ", vbTextCompare) > 0 _
        Or InStr(1, strReplyPart, "Let me follow up ", vbTextCompare) > 0 _
        ' Ask to set reminder
        If MsgBox("I detected a promise to do something! Should I set a flag on this message?", vbYesNo + vbExclamation, "Attention!") = vbYes Then
            Item.MarkAsTask olMarkToday
            Item.ReminderTime = Now + (15 / 24 / 60) ' Set reminder 15 minutes from now
            Item.ReminderSet = True
        End If
    End If
End Sub

You can of course extend the check for key phrases to include any phrase you like…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>