How to set a flag to follow up using VBA

Last reviewed on May 2, 2013

You can edit the Flag to Follow up field text each time you flag a message, but you can't save the changes permanently, or even temporarily in an MRU list. However, you can use VBA to set flags, which will allow you to save custom Flag to text, as well as custom reminder times and start or due dates.

Set a custom flag for followupThis code sample sets a flag to "Call display-name", with a due date in 3 days and a reminder set for 2 days.

To create the macro, open the VBA editor using Alt+F11. Right click on Project1 and choose Insert > Module. Paste the macro into the module and edit as needed.

You'll also need the GetCurrentItem function from Work with an open or selected Outlook item. Paste it in the module following this macro.

For more information on using VBA, see How to use the VBA Editor.

To use the macro, open or select a message and run the macro.


Public Sub SetCustomFlag()

Dim objMsg As Object

' GetCurrent Item function is at http://slipstick.me/e8mio
Set objMsg = GetCurrentItem()

With objMsg

' due this week flag
    .MarkAsTask olMarkThisWeek
' sets a specific due date
    .TaskDueDate = Now + 3

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

Set objMsg = Nothing
End Sub

Note: if you don't include the .MarkAsTask line, the flag will be the 'people flag'. If you use olMarkToday and set the due date for next week, it's converted to a 'next week' flag.

Outlook 2003

If you are using Outlook 2003, you need to edit the code a little, as Outlook 2003 uses colored flags.

Allowable Flag colors
olNoFlagIconolPurpleFlagIcon
olOrangeFlagIconolGreenFlagIcon
olYellowFlagIconolBlueFlagIcon
olRedFlagIcon


Public Sub SetCustomFlag()

Dim objMsg As Object

' GetCurrent Item function is at http://slipstick.me/e8mio
Set objMsg = GetCurrentItem()

With objMsg
    .FlagIcon olPurpleFlagIcon
    .FlagDueBy = Now + 3
    .FlagRequest = "Call " & objMsg.SenderName
    .ReminderSet = True
    .ReminderTime = Now + 2
    .Save
End With

Set objMsg = Nothing
End Sub

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999 and involved in IT support since 1985, Diane is the author of several books and video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.