Witzker
Senior Member
- OS Version(s)
- iOS
- Outlook version
- Outlook 2019 32-bit
- Email Account
- Exchange Server 2007
Hi,
I want to speed up workflow in OL 2019 GERMAN version
I have this macro to goto inbox
How to modify this to GoTo the use defined seachfolder:
Hope for help
PS:
I tried with this macro to find the right name, but this does not work:
I want to speed up workflow in OL 2019 GERMAN version
I have this macro to goto inbox
Code:
Sub GoTo_Posteingang()
Set Application.ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderInbox)
End Sub
How to modify this to GoTo the use defined seachfolder:
Hope for help
PS:
I tried with this macro to find the right name, but this does not work:
Code:
Sub ListSearchFolders()
Dim myNamespace As NameSpace
Dim mySearchFolders As Folders
Dim myFolder As Folder
Dim myItems As Items
Dim myItem As Object
Dim msgBody As String
'Get the default Inbox folder and the search folders in it
Set myNamespace = Application.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)
Set mySearchFolders = myFolder.Folders
'Loop through each search folder and add its name to the message body
For Each myFolder In mySearchFolders
If myFolder.DefaultItemType = olMailItem And myFolder.IsSearchFolder Then
msgBody = msgBody & vbCrLf & myFolder.Name
End If
Next myFolder
'Create a new email message with the search folder names in the body
Set myItems = myNamespace.GetDefaultFolder(olFolderDrafts).Items
Set myItem = myItems.Add(olMailItem)
myItem.To = "recipient@example.com"
myItem.Subject = "List of Search Folders"
myItem.Body = "The following search folders are defined in your Inbox:" & vbCrLf & msgBody
myItem.Display
'Clean up
Set myNamespace = Nothing
Set mySearchFolders = Nothing
Set myFolder = Nothing
Set myItems = Nothing
Set myItem = Nothing
End Sub