Welcome to Office Zealot Sign in | Join | Help

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!

Published Wednesday, April 23, 2008 7:58 AM by legault
Filed under:

Comments

# Weekend reading

Outlook 2007: Sync error 0x80190194 (OAB synchronization) Single Instance Storage Exchange when moving

Friday, April 25, 2008 10:59 AM by subject: exchange
Anonymous comments are disabled