Wednesday, 18 March 2009

Outlook: archive it!

I'm a huge fan of gmail. Although it takes some getting used to, I'm sure everyone who uses gmail loves it after some time, and would have a hard time going back to other clients. My problem is that I must use MS Outlook at work...it's inescapable. One feature I've grown quite fond of in gmail is the ability to Archive messages instantly. This allows you to get more work done by leaving only the action items in your inbox (which is what an "inbox" really is, isn't it?).

Here's how you can accomplish this in Outlook (2007):
  1. Open MS Outlook 2007
  2. Create a new sub-folder inside the Inbox named Pre Archive
  3. Under the Tools menu, select Macro > Visual Basic Editor (or Alt+F11)
  4. In the left menu bar, expand Project1, Microsoft Outlook Session, and open ThisOutlookSession
  5. Enter the following code:


Option Explicit
Public Sub ArchiveSelectedItems()
MoveSelectedItemsToFolder "Pre Archive"
End Sub
Private Sub MoveSelectedItemsToFolder(FolderName As String)
On Error GoTo ErrorHandler
Dim Namespace As Outlook.Namespace
Set Namespace = Application.GetNamespace("MAPI")
Dim Inbox As Outlook.MAPIFolder
Set Inbox = Namespace.GetDefaultFolder(olFolderInbox)
Dim Folder As Outlook.MAPIFolder
Set Folder = Inbox.Folders(FolderName)
If Folder Is Nothing Then
MsgBox "The '" & FolderName & "' folder doesn't exist!", _
vbOKOnly + vbExclamation, "Invalid Folder"
End If
Dim Item As Object
For Each Item In Application.ActiveExplorer.Selection
If Item.UnRead Then Item.UnRead = False
Item.Move Folder
Next
Exit Sub
ErrorHandler:
MsgBox Error(Err)
End Sub


Now:
  1. Save the code and exit the Visual Basic Editor
  2. Under View > Toolbars > Customize, select the Commands tab
  3. Click on Macros
  4. Drag Project1.ArchiveSelected command to any toolbar above
  5. Rename your button to Archive by right-clicking
  6. From the right-click, you can also Change Button Image
  7. Click Close

Optional:
  1. Open any message in the Inbox folder
  2. Click the Customize Quick Access Toolbar button on the title bar
  3. Select More Commands
  4. Add the Project1.ArchiveSelected command and configure the same way as above
  5. Make sure you have allowed Outlook to run macros.
Done! You now have an Archive button that archives unwanted messages from your inbox. I also recommend modifying your AutoArchive settings to no longer archive anything from your Inbox. Instead try archiving your Pre Archive folder every couple of days.

(click to enlarge)

  © Blogger template 'Isolation' by Ourblogtemplates.com 2008

Back to TOP