This macro is the result of a question from a "Getting Things Done" user who wanted a better way to manage tasks on his smartphone.
I use the GTD method and I’ve found that assigning categories doesn’t work for me, one reason is I like to sync the tasks to my iPhone. When you just assign categories and dump everything in one big bucket you have to constantly expand and collapse your views to isolate the right group – lots of clicking and mouse moving. I want to select a message from my inbox – then click on a macro button and have it copied to the appropriate task folder – Do It Today, Deferred, etc. It would look like just like the buttons in the Quick Steps, but unfortunately they just assign the category. I found Create a Task from an Email using a Rule but need help making it work.
Copy the following code block, one copy for each Task folder, and replace the Sub name and folder name (in tFolder) with the name of the folder it will apply to.
Sub TasksFoldername() tFolder = "Old Tasks" CreateTasks End Sub
Create QAT or ribbon buttons for the folder macros. To do this, go to File, Options, Customize Ribbon (or Quick Access Toolbar). In Choose commands from, select Macros. Select the folder macros and click the Add button to add them to the QAT or a ribbon. (If using the ribbon, you need to add a New Group first.)
Tip: if you use the QAT, you can assign keyboard shortcuts to the macros.
Create tasks from email
To use, you need the GetCurrentItem function from Outlook VBA: work with open item or selected item. This will allow the code to work with open or selected messages.
Public tFolder As String Private Sub CreateTasks() Dim Ns As Outlook.NameSpace Dim olTask As Outlook.TaskItem Dim Item As Outlook.mailItem Set Ns = Application.GetNamespace("MAPI") ' Get Function at //slipstick.me/e8mio Set Item = GetCurrentItem() Set taskFolder = Ns.GetDefaultFolder(olFolderTasks).Folders(tFolder) Set olTask = taskFolder.Items.Add(olTaskItem) With olTask .Subject = Item.Subject .Attachments.Add Item .Body = Item.Body .DueDate = Now + 1 .Save .Display 'show the task to add notes End With Set Ns = Nothing End Sub ' create one macro for Tasks each folder ' add to ribbon or QAT button Sub TasksFoldername1() tFolder = "My Tasks" CreateTasks End Sub Sub TasksFoldername2() tFolder = "Old Tasks" CreateTasks End Sub