Thursday, September 16, 2010

Outlook 2007 - Create Task from Email

Final macro for a thorough GTD approach to the email inbox. This will create a Task form with the contents of the email prepopulated in the task form. This macro allows detailed tasks to be generated by the click of the mouse, managing workflow through the Task viewer in Outlook!


Public Sub AddToTasks()
Dim olTask As Outlook.TaskItem
Dim olMail As MailItem
Dim olIns As Inspector
Dim olExp As Explorer
Set olTask = Application.CreateItem(olTaskItem)
Set olExp = Application.ActiveExplorer

If olExp.CurrentView "Messages" Then Exit Sub
If olExp.Selection.Count 1 Then Exit Sub

Set olMail = olExp.Selection.Item(1)

With olTask
.Subject = olMail.Subject
.Body = olMail.Body
.StartDate = Now
.DueDate = DateAdd("d", 7 - Format$(Date, "w", vbSaturday), Date)
.ReminderSet = False
olTask.Status = olTaskInProgress
End With

Set olIns = olTask.GetInspector
olIns.Display ("True")
End Sub

No comments:

Post a Comment