Pages

Saturday, April 24, 2010

Outlook and GTD (Another Macro)

In my hunt to further my automation of Outlook with in my GTD set up, I found another macro on the Davidco forum by member PDJunieB that will allow you to bulk delete all the completed tasks in one step.  At the time I was looking for something that would just automatically move them to an archive folder when they were marked complete, but after thinking about it for a minute I realized that the steps were already captured in OneNote as the action steps of the various projects, or they were just the housekeeping tasks for my weekly review.  No need to keep more than one copy of them so getting rid of them is just fine. 

The Macro is as follows:

Sub DeleteCompletedTasks()
Dim myTask As taskItem
Dim i As Long
For i = Outlook.ActiveExplorer.CurrentFolder.Items.Count To 1 Step -1
Set myTask = Outlook.ActiveExplorer.CurrentFolder.Items(i)
If myTask.Class = olTask Then
If myTask.Complete Then
myTask.Delete
End If
End If
Next
End Sub

For me this worked beautifully, Junie if you ever trip across this post, thank you, thank you, thank you!!! You lowered the PITA* factor in Outlook yet another notch!!

* PITA = Pain In The A**