Outlook Macro: Flag and Move Message to Follow-up Folder

As my readers know I follow many of the Getting Things Done methods and when it comes to e-mail I try (usually unsuccessfully) to keep my inbox uncluttered.  In Outlook there is a great feature called Flags that will turn an e-mail into an item on the To-Do list without creating a task.  Of course if you just flag it you will need to move it if you intend to keep your inbox clean.

To speed up the process of flagging and moving the message I have created the following scripts to move the task to a follow-up folder and flag if for start and completion the following work day.  This allows me to review and schedule the task that are processed for follow-up after I have filed the items that need no further action.

I have created a button on the Outlook toolbar to perform this task on the select item but could easily modify the provided code to add additional subroutines that would flag or categorize the items in an infinite number of combinations.

To use the following code just copy and paste it into the macros in Outlook 2007:

Sub FlagSelectedMessageForFollowUpAndMove()
On Error Resume Next
    Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
    Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
    FlagForFollowUpNextWeekday
   
    Set objNS = Application.GetNamespace("MAPI")
    Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
'Note to users  ***  You need to change the folder name and it must be a sub-folder of the inbox
    Set objFolder = objInbox.Folders("Follow-up Issues")
'Assume this is a mail folder
If objFolder Is Nothing Then
        MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER"
    End If
    If Application.ActiveExplorer.Selection.Count = 0 Then
        'Require that this procedure be called only when a message is selected
        Exit Sub
    End If
    For Each objItem In Application.ActiveExplorer.Selection
        If objFolder.DefaultItemType = olMailItem Then
            If objItem.Class = olMail Then
                objItem.Move objFolder
            End If
        End If
    Next
    Set objItem = Nothing
    Set objFolder = Nothing
    Set objInbox = Nothing
    Set objNS = Nothing
End Sub
Sub FlagForFollowUpNextWeekday()
'Based on code presented at: http://skillzdesign.com/blog/2008/01/02/flag-microsoft-outlook-inbox-items-for-follow-up-script/
    Dim Days As Integer
    Dim DayOfWeek As Integer
   
   
    Days = 1
    DayOfWeek = DatePart("w", Now() + Days)
   
    Do Until (DayOfWeek > 1 And DayOfWeek < 7)
        Days = Days + 1
        DayOfWeek = DatePart("w", Now() + Days)
    Loop
   
    FlagForXDays Days, "Follow Up", "@NotAssigned"
   
End Sub
Sub FlagForXDays(intDays As Integer, strFlagRequest As String, strCategories)
'Based on code presented at: http://skillzdesign.com/blog/2008/01/02/flag-microsoft-outlook-inbox-items-for-follow-up-script/
'Modified by Marc Rohde (http://marc.rohde-net.us) to the flag by a number of days.
   
    Dim Item As Object
    Dim SelectedItems As Selection
    Dim dtTaskDate As Date
   
    dtTaskDate = CStr(CDate(Format(CDbl(Now) + intDays)))
   
   
    Set SelectedItems = Outlook.ActiveExplorer.Selection
        For Each Item In SelectedItems
            With Item
                .ToDoTaskOrdinal = dtTaskDate
                .TaskDueDate = dtTaskDate
                .TaskStartDate = dtTaskDate
                .FlagStatus = 2
                .FlagRequest = strFlagRequest
                .Categories = strCategories
                .FlagIcon = 6
                .Save
            End With
        Next Item
End Sub
Reblog this post [with Zemanta]

Technorati Tags: , , , , , , , , , , ,

  • Share/Bookmark

Related posts:

  1. E-Mail Managment Best Practices Regular blog readers will notice that e-mail and task managment...

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

I know this post is about tweaking Outlook to do GTD, however, you might want an easier way with an all electronic system built for GTD.

I found an application that allows me to view my entire GTD at work on my Win machine, at home on my Macs and even on my cell phone. And another app lets me call in tasks to my GTD without any writing or typing, great for those thoughts that hit me while driving. I’ve written about my experiences with GTD in a blog post at http://johnkendrick.wordpress.com/2008/03/27/more-getting-things-done/ John

John, thank for the tip. If you are interested in the my GTD systems you may want to look at:

http://marc.rohde-net.us/2008/04/my-ubiquitious-capture-system/

[...] Step 1: Copy and paste a macro off the Internet like this one for moving an Outlook email to a different folder: [...]

Just acquainted myself with 43 folders and the idea of Getting Things Done. Your code is exactly what I was looking for. Thanks!

Hi,

This is exactly what I am looking for. One problem though.

I use Outlook 2007, and after the message is moved to the folder, the timestamp on the message item is reset to now??

Any way to stop that?

Ludwich

Are you just trying to move a flagged message or flag it an move it? I have some other code that will just move it to another folder and skip the flag.

hi every person,

I identified marc.rohde-net.us after previous months and I’m very excited much to commence participating. I are basically lurking for the last month but figured I would be joining and sign up.

I am from Spain so please forgave my speaking english...

Leave a comment

(required)

(required)