VBOffice

Get the Message Folder

Where is the message stored you're looking at? This macro tells you and can even open the folder for you.

Last modified: 2008/06/08 | Accessed: 55.861  | #65
◀ Previous sample Next sample ▶
OLKeeper OLKeeper
OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or e-mails.

If you search in multiple folders for an e-mail, Outlook can tell you the name of the folder the e-mail has been found in. But if you have multiple folders with the same name, this information is quite useless. This macro tells you the full folder path. Additionally, it offers to switch to the folder.

If you used the advanced search, it's necessary to open the e-mail first before calling the macro.


tip  How to add macros to Outlook
Public Sub GetItemsFolderPath()
  Dim obj As Object
  Dim F As Outlook.MAPIFolder
  Dim Msg$
  Set obj = Application.ActiveWindow
  If TypeOf obj Is Outlook.Inspector Then
    Set obj = obj.CurrentItem
  Else
    Set obj = obj.Selection(1)
  End If
  Set F = obj.Parent
  Msg = "The path is: " & F.FolderPath & vbCrLf
  Msg = Msg & "Switch to the folder?"
  If MsgBox(Msg, vbYesNo) = vbYes Then
    Set Application.ActiveExplorer.CurrentFolder = F
  End If
End Sub
Reporter Reporter
VBOffice Reporter is an easy to use tool for data analysis and reporting in Outlook. A single click, for instance, allows you to see the number of hours planned for meetings the next month.
email  Send a message