VBOffice

Flag an Email for Follow-up

This demonstrates how to flag emails for follow-up.

Last modified: 2008/10/17 | Accessed: 23.419  | #71
◀ Previous sample Next sample ▶

Content

ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.

Bis Outlook 2003

Do you also have your rules for flagging e-mails for follow-up? For instance, less urgent items for "this evening"; see whether or not the customer has answered yet for "next week", etc. This VBA sample helps you save some time, for instance, by determining a date and time for certain cases.

The sample comes with three options, "this evening" (7 p.m.), "tomorrow" (7 p.m. as well), and "next week" (8 a.m.). Of course, you might want to customize the times and colors. You may even change the default message by writing your own text to the Mail.FlagRequest property.

As always, for calling the functions right click a toolbar, click Customize, Macros, and drag the available macro names to the toolbar.


tip  How to add macros to Outlook
Public Enum FlagWhatEnum
  flNextWeek = 0
  flThisEvening = 1
  flTomorrow = 2
End Enum

Public Sub FlagNextWeek()
  FlagItem flNextWeek
End Sub

Public Sub FlagThisEvening()
  FlagItem flThisEvening
End Sub

Public Sub FlagTomorrow()
  FlagItem flTomorrow
End Sub

Private Sub FlagItem(FlagWhat As FlagWhatEnum)
  Dim Mail As Outlook.MailItem
  Dim obj As Object
  Dim Sel As Outlook.Selection
  Dim i&
  Dim dt As Date
  Dim tm As String
  Dim Icon As OlFlagIcon

  Select Case FlagWhat
  Case flNextWeek
    dt = DateAdd("d", 7, Date)
    tm = CStr(dt) & " 08:00"
    Icon = olOrangeFlagIcon
  Case flThisEvening
    dt = Date
    tm = CStr(dt) & " 19:00"
    Icon = olYellowFlagIcon
  Case flTomorrow
    dt = DateAdd("d", 1, Date)
    tm = CStr(dt) & " 08:00"
    Icon = olYellowFlagIcon
  End Select

  Set obj = Application.ActiveWindow
  If TypeOf obj Is Outlook.Explorer Then
    Set Sel = obj.Selection
    For i = 1 To Sel.Count
      Set obj = Sel(i)
      If TypeOf obj Is Outlook.MailItem Then
        Set Mail = obj
        Mail.FlagDueBy = tm
        Mail.FlagIcon = Icon
        Mail.Save
      End If
    Next
  Else
    Set obj = obj.CurrentItem
    If TypeOf obj Is Outlook.MailItem Then
      Set Mail = obj
      Mail.FlagDueBy = tm
      Mail.FlagIcon = Icon
      Mail.Save
    End If
  End If
End Sub
OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.

Since Outlook 2007

With the new ToDo bar since Outlook 2007 the steps for flagging for follow-up have changed a little bit, too.

Public Enum FlagWhatEnum
  flNextWeek = 0
  flThisEvening = 1
  flTomorrow = 2
End Enum

Public Sub FlagNextWeek()
  FlagItem flNextWeek
End Sub

Public Sub FlagThisEvening()
  FlagItem flThisEvening
End Sub

Public Sub FlagTomorrow()
  FlagItem flTomorrow
End Sub

Public Sub FlagItem(FlagWhat As FlagWhatEnum)
  Dim Mail As Outlook.MailItem
  Dim obj As Object
  Dim Sel As Outlook.Selection
  Dim Item As Object
  Dim i&
  Dim dt As Date
  Dim tm As String
  Dim Icon As OlMarkInterval

  Select Case FlagWhat
  Case flNextWeek
    dt = DateAdd("d", 7, Date)
    tm = CStr(dt) & " 08:00"
    Icon = olMarkNextWeek
  Case flThisEvening
    dt = Date
    tm = CStr(dt) & " 19:00"
    Icon = olMarkToday
  Case flTomorrow
    dt = DateAdd("d", 1, Date)
    tm = CStr(dt) & " 08:00"
    Icon = olMarkTomorrow
  End Select

  Set obj = Application.ActiveWindow
  If TypeOf obj Is Outlook.Explorer Then
    Set Sel = obj.Selection
    For i = 1 To Sel.Count
      Set obj = Sel(i)
      If TypeOf obj Is Outlook.MailItem Then
        Set Mail = obj
        Mail.MarkAsTask Icon
        Mail.TaskStartDate = tm
        Mail.TaskDueDate = tm
        Mail.Save
      End If
    Next

  Else
    Set obj = obj.CurrentItem
    If TypeOf obj Is Outlook.MailItem Then
      Set Mail = obj
      Mail.MarkAsTask olMarkNextWeek
      Mail.TaskStartDate = tm
      Mail.TaskDueDate = tm
      Mail.Save
    End If
  End If
End Sub
SAM SAM
Determine the "identity" of your emails. Set with SAM the sender, signature and folder for sent items with the help of rules.
email  Send a message