Nov 11 2007

Managing Email in Outlook

Published by under Tech

I’ve found that the trick to staying on top of email is to have a fast system for handling mail that requires no action on my part by getting it stored outside of my Inbox, as fast as possible. To do this, I’ve created a Macro in Outlook that moves the currently open email into a folder named for the Sender.

For this script to work, you must have a folder Called “People” under Inbox.

To implement this Macro in Outlook, go to Tools… Macro… Visual Basic Editor

You’ll see a blank workspace. Cut and paste the code below into the workspace.

Sub movetoPeople()
On Error Resume Next  ' We'll handle errors ourselves

    Dim myOlApp As New Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myInbox As Outlook.MAPIFolder

    Dim destprefix As Outlook.MAPIFolder
    Dim dest As Outlook.MAPIFolder
    Dim item As Object
    Dim fname As String
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set item = myOlApp.ActiveInspector.CurrentItem
    fname = item.SenderName
    Set destprefix = myNameSpace.GetDefaultFolder(olFolderInbox).Folders("People")
    If Err.Number <> 0 Then   ' Check to see if anything has failed yet
    MsgBox (fname)
    MsgBox (destprefix)
        MsgBox "Problem"
        Exit Sub
    End If
    Set dest = destprefix.Folders(fname)
    If Err.Number <> 0 Then    ' An error here means the folder doesn't exist
        destprefix.Folders.Add fname
        Set dest = destprefix.Folders(fname)
    End If
    item.Move dest
    If Err.Number <> 0 Then
        MsgBox "Problem"
        Exit Sub
    End If

End Sub

Then just quit the Visual Basic Editor. It will automatically save your changes.

Now we want to add this Macro as a button on all of the emails we open.

  • In Outlook 2007, open any email and right click on the Quick Access Toolbar.
  • Select Customize Quick Access Toolbar…
  • In the Choose commands from: pull down, select Macros.
  • Select Project1.movetoPeople and hit the Add >> button. (I like to move the button to the bottom of the list so that it is easy to see on the Quick Access Toolbar.)
  • Hit the Ok button, and notice that you email now has a little Macro icon/button. (You can change the icon by hitting the Modify… button before hitting Ok if you like.)
  • Hit the folder button and the current email will be moved to the Inbox/People/SENDER folder.

If there isn’t already a folder named SENDER, the script creates it. The email is also closed and you are presented with the Inbox list of email.

If you want to call the folder something other than “People”, just change:

Set destprefix = myNameSpace.GetDefaultFolder(olFolderInbox).Folders(“People”)

to something else:

Set destprefix = myNameSpace.GetDefaultFolder(olFolderInbox).Folders(“SOMETHINGELSE”)

and make sure you’ve created the Inbox/SOMETHINGELSE folder.

Older versions of Outlook have similar methods of adding buttons to new emails.

The script is for Microsoft Outlook, but the methodology is built in to Eudora, and I’ve hacked it into GroupWise using a third party scripting application called Formativ. I haven’t figured out how to similarly enable Thunderbird yet, so any suggestions would be great!

3 responses so far