Operating system:: Windows 10
Outlook version: 365
Email type or host: Microsoft Exchange
Outlook version: 365
Email type or host: Microsoft Exchange
I was using this code a while ago, I'm not sure if it was from this forum.
It can do:
(1) Jump to folder
But also would like it to do:
(2) Select message that you searched for
Reason is that there can be a lot of emails in a folder.
It can do:
(1) Jump to folder
But also would like it to do:
(2) Select message that you searched for
Reason is that there can be a lot of emails in a folder.
Code:
Option Explicit
Public Sub get_folder_path()
Dim my_object As Object
Dim my_folder As Outlook.MAPIFolder
Dim MyMessage$
Set my_object = Application.ActiveWindow
If TypeOf my_object Is Outlook.Inspector Then
Set my_object = my_object.CurrentItem
Else
Set my_object = my_object.Selection(1)
End If
Set my_folder = my_object.Parent
MyMessage = "Path:" & vbCrLf & my_folder.FolderPath & vbCrLf & vbCrLf
MyMessage = MyMessage & "Switch to folder?"
If MsgBox(MyMessage, vbYesNo) = vbYes Then
Set Application.ActiveExplorer.CurrentFolder = my_folder
End If
End Sub