Banal Minutiae

This is a place for Grant, Gretchen, Claire and Charles to keep track of what's going on in our lives and keep our friends and family updated as well.

Thursday, November 15, 2007

Getting Things Done with Outlook 2007: Send and Delegate

Normally I have been successful in integrating David Allen's Getting Things Done into my daily work flow. It is easy to process inbound emails into the Calendar (Hard Landscape) or the Task Folder (Next Actions). However, one of the issues that I ran into was how to easily set an @Waiting For task to an outbound email.

In the past, if I wanted to delegate a task based on a sent email, I had to compose and send the email, go to the Sent Items folder, find the sent email and drag it to the task folder, categorize and close the task. I categorize each task with two contexts, @Waiting for and @[Insert Delegate Name Here].

I figured there must be an easier way: write a macro to do this for me. This macro will do the following:

  1. Move a copy of the sent email to the tasks folder
  2. Categorize the task as @Waiting for and with @[Name of Recipient]

Now, I don't have a lot of experience writing Visual Basic code, so most of this was gleaned from several sources, the main inspiration of which came from Simon Guest at simon.says . Otherwise, I couldn't find anything that would do exactly what I wanted, so I wrote it myself.

To implement this macro, you will need to press ALT + F11 to open the Visual Basic Editor in Outlook.

Note: Unless you create a signed macro, you will also have to turn off Macro Security by choosing Tools -> Macros -> Security. (If you're not comfortable with this, go to Microsoft's discussion of macro signing)

You will need to place this code in the "ThisOutlookSession" module in order to have it work.



Copy and paste the following code into the module:



Sub NewWaitingForTask()

'Basic Error Handler
On Error GoTo NewWaitingForTask_Err

'Declarations
Dim myItem As MailItem
Dim myolApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myTask As Outlook.TaskItem
Dim Category As String

Set myolApp = CreateObject("Outlook.Application")
Set myNamespace = myolApp.GetNamespace("MAPI")

'Add comma delimited string here
Category = "@Waiting For"


Set myItem = Application.ActiveInspector.CurrentItem

'Create a new Task
Set myTask = Outlook.Application.CreateItem(olTaskItem)

'Copies email details into new task
With myTask
.Subject = myItem.Subject
.Categories = Category + ", @" + myItem.To
.Body = myItem.Body
.Save
End With

'Sends Current Item
myItem.Send


'Clear Memory
NewWaitingForTask_Exit:
Set myolApp = Nothing
Set myNamespace = Nothing
Set myItem = Nothing
Set myTask = Nothing
Exit Sub

'In Case of Error
NewWaitingForTask_Err:
MsgBox "An unexpected error has occurred." _
& vbCrLf & "Error Description: " & Err.Description _
, vbCritical, "Error!"
Resume NewWaitingForTask_Exit

End Sub

You can close the window to exit the VB editor.

Now we are going to create a button and keyboard shortcut.

  1. Create a new email message.
  2. Choose "Editor Options" from the Office Button (big shiny windows logo in the upper left corner)
  3. Click "Customize" in the left hand pane
  4. Choose "Macros" from the "Choose Commands from Here" dropdown
  5. Drag the Macro from the left box to the right.
  6. Highlight the Macro in the right hand box and click "Modify"
  7. Choose a dandy icon and give it a new name, like "Send @Waiting For"
  8. Click OK

The easy part is that Outlook assigns a keyboard shortcut to the button for you. Just hold down the ALT key, and the new button will have a number hovering over it. In my case, the number is 6. So either click the new button to run the macro, or hit ALT + 6.



That's it!

Use these instructions and this code at your own risk. I'm sure this code is crappy, but it works for me!

Labels:

Thursday, November 01, 2007

Halloween Picture