Victor_50
Member
- Outlook version
- Outlook 2013 32 bit
- Email Account
- POP3
Operating system:: W11 pro
Outlook version: Classic Outlook
Email type or host: POP
Outlook version: Classic Outlook
Email type or host: POP
For a long time I wanted a way to jump to the folder an email is in. From "Favorites" or from the folder specified in a searchfolder. I recently found VBA code, that worked up to a certain point. But instead of jumping to the folder it jumped to "Notes" in the sidebar. Apparently MS changed something. I wanted to fix this by first jumping to some folder (Inbox) if necessary and then jumping to the real folder. It turns out MS has made referencing folders in Outlook so complex, I couldn't fix this, especially while the new "help" in "learn" really can't learn me anything. My unfinished code:
Code:
Public Sub GetItemsFolderPath()
Dim obj As Object
Dim Vname As Outlook.NameSpace
Dim Vmapi As Outlook.MAPIFolder
Dim Vfolder1 As String
Dim Msg$
Set obj = Application.ActiveWindow
Set Vname = Application.GetNamespace("MAPI")
If TypeOf obj Is Outlook.Inspector Then
Set obj = obj.CurrentItem
Else
Set obj = obj.Selection(1)
End If
Set Vmapi = obj.Parent 'real foldername
Vfolder = Vmapi.FolderPath
'Debug.Print Vfolder
If Application.ActiveExplorer.NavigationPane.CurrentModule.NavigationModuleType = 0 Then 'apparently in favorites
' Code for jumping to inbox in same store (pst)
End If
' Code for jumping to actual folder in same store (pst)
End Sub