StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1796626
Impressions6731633
Links
Imprint
Privacy Policy
Contact
E-Mail: Flag for follow-up (since Outlook 2007)
Author: Michael BauerHomepage
Date: 17.01.2011Accessed: 12461
  
Description

(Update: With the new todo bar introduced with Outlook 2007, flagging an email for follow up has changed. Hence the code slightly differs from previous versions.)

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 does a lot of the necessary work for you; without that especially selecting a date and time would take much of your valuable time.

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.

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
 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]