While using Outlook 2007 as my GTD tool, one of the things I’ve been missing is having the ability to rename tasks on the fly. Here’s a pretty common situation:
· A new message arrives with the subject of “RE: Purchase Order”. It’s from Jack, and after reading the Email I realize that I need to call Bob to confirm the quantity.
· I flag it as a task in Outlook, assign some categories (let’s say @Office and ProjectX), and move it to my tasks folder.
· As you may know, this creates a new task with the subject of “RE: Purchase Order”. What I really want however is to change the name of the task to something more descriptive – for example “Speak to Bob about quantity required for the order”.
You can do this renaming in the to-do list, but this requires the step of going into the to-do list, finding the aforementioned task and then changing the name in the list.
After figuring out that I needed something more automated, I wrote the following macro:
Function FileFolderEntryId() As String Dim myolApp As Outlook.Application Dim myNamespace As Outlook.NameSpace Dim myInbox As Outlook.folder Dim rootFolder As Outlook.folder Dim subFolders As Outlook.Folders Dim subFolder As Outlook.folder Dim fileFolder As Outlook.folder Dim fileEntryID As String Dim fileFolderName As String 'Set the folder name - must be at the same level as the inbox fileFolderName = "File" ' Move the the file folder Set myolApp = CreateObject("Outlook.Application") Set myNamespace = myolApp.GetNamespace("MAPI") Set myInbox = myNamespace.GetDefaultFolder(olFolderInbox) Set rootFolder = myInbox.Parent Set subFolders = rootFolder.Folders Set subFolder = subFolders.GetFirst Do While Not subFolder Is Nothing If subFolder.Name = fileFolderName Then fileEntryID = subFolder.EntryID Exit Do End If Set subFolder = subFolders.GetNext Loop ' return the entry ID for the file folder FileFolderEntryId = fileEntryID
Dim item As MailItem
Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim fileFolder As Outlook.folder
Dim newName As String
' Pick the category
Set item = Outlook.Application.ActiveExplorer.Selection.item(1)
' Mark as unread
item.UnRead = False
'validate to see whether two categories exist, including an action
If (item.categories <> "") Then
If (InStr(item.categories, "@") > 0) Then
If (InStr(item.categories, ",") > 0) Then
' Set the follow up flag
' Move the item to the file folder
Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")
Set fileFolder = myNamespace.GetFolderFromID(FileFolderEntryId())
' Ask for a different name if required
newName = InputBox("Please enter a subject for the task:", "Task Subject", item.TaskSubject)
item.TaskSubject = newName
The above does everything for me – assigns the categories, and prompts me for a task subject before moving it to my file folder (highlighted). What’s really nice about this is that the subject of the underlying Email remains the same (it’s only the task’s subject that changes). This means that after I’ve spoken to Bob about the quantity, the reply to the original Email from Jack will still have the original subject of “RE: Purchase Order”. Pretty Cool.
*** Update: Fixed post with the FileFolderEntryId() function ***