Hey Outlook, where’s that folder?

I use Xobni and Outlook 2007’s Instant Search quite often.  Once I find and open the e-mail that I’ve retrieved using either mechanism, I almost always want to find and display the folder where that message is stored.  So here’s a quick and handy little macro that will do just that:

Sub DisplayFolderContainingOpenItem()
On Error Resume Next

Dim objFolder As Outlook.MAPIFolder
Dim objExpl As Outlook.Explorer

‘Don’t do anything if nothing is open!
If ActiveInspector Is Nothing Then Exit Sub

Set objFolder = ActiveInspector.CurrentItem.Parent
objFolder.Display
Set objExpl = objFolder.GetExplorer
objExpl.WindowState = olMaximized

Set objExpl = Nothing
Set objFolder = Nothing
End Sub

Unfortunately there’s no way to select the current message in the folder as well – we’ll have to wait until the next version of Outlook to see if the Product Team has added such functionality to the object model.  😉

ROCK!

Eric Legault

Microsoft Outlook MVP (15 yrs). Author: Microsoft Office 2013 Pro Step By Step. Consultant/speaker/Outlook add-in builder/SharePoint pioneer. Guitarist: Maiden Canada (Iron Maiden tribute band)

You may also like...

%d bloggers like this: