Saturday, October 3, 2009

GTD Outlook: create email to task macro

On a daily basis, I usually receive a lot of emails. Some I will never read because they don't concern me, but for most of those emails, I need to answer. I sometime don't have time to answer right away. I used to put it in a folder, or leave the email unread, so that I remember that i need to do something about it. But when I was getting reaaally a lot of emails, that wasn't really working. It's wasn't really convenient. Not only it isn't convenient,

Similarly I sometime send email to people, but ... other people are busy, or can't or simply won't answer. So you have to chase them. But again that means you have to remember to chase them.
That makes a lot of things to remember, on top of the usual things you have to do. It wasn't really efficient, which is bad enough, but it also hampered my productivity.

So whenever I receive an email I need to answer, or send an email and make sure I receive an answer in the timeframe I expect (or chase that person), I started to create an outlook task for each of those email. This way I don't have to clutter my mind with little things, and leave room for other more important things to remember. I suppose was the result of reading those article about GTD and productivity.

If you wonder what GTD (also known as "Getting Things Done") is, it is a method (or a collection of various methods) put together by David Allen, famous productivity guru. He wrote a book on the subject called Getting Things Done which i very highly recommand. It's one of those Must read book.

That being said back to the point. That trick of manually creating a task for each mail I was sending or receiving very rapidly grew old.

So I've made a little macro in outlook, that simply create a task from an email, and automatically add that email as an attachement of the task. A very simple to use I just select an mail, and launch a macro and it pops up the create task window, with the selected email automatically pasted in copy. I only have to set the reminder date.

Heres' the code of the macro in question:
Sub MakeTaskFromMail(MyMail As Outlook.MailItem)
   Dim objTask As Outlook.TaskItem
   Set objTask = Application.CreateItem(olTaskItem)
   With objTask
       .Subject = MyMail.Subject
       .DueDate = MyMail.SentOn
   End With

   objTask.Attachments.Add MyMail
   objTask.Display

End Sub

Function GetCurrentItem() As Object
   Dim objApp As Outlook.Application

   Set objApp = Application
   On Error Resume Next
   Select Case TypeName(objApp.ActiveWindow)
       Case "Explorer"
           Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
       Case "Inspector"
           Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
       Case Else
           ' anything else will result in an error, which is
           ' why we have the error handler above
   End Select

   Set objApp = Nothing
End Function

Sub MakeTaskFromCurrentMail()
   Dim currentMail As Outlook.MailItem
   Set currentMail = GetCurrentItem()
   MakeTaskFromMail currentMail
End Sub

Now that works pretty well, but since I'm really lazy and like things to go smoothly, I created a little button that calls the macro, and that the final touch (one could even associate a shortcut). Now in a single click I create a task from any email in my inbox and only have to set the date I want to be reminded.

That simple trick really eased my life and now i almost never forget to answer an email or chase someone to get my answer.

Hopefully this will help others.