

If ( "Unread Mail") Thenįor Each xAccountFld In xNameSpace.Foldersįor Each xSubFolder In xAccountFld.Folders Set xSelMail = (1)ĭim xAccountFld, xTargetFld, xSubFolder As MAPIFolder Set xNameSpace = xOlApp.GetNamespace("MAPI")įor Each xTargetFld In (1).Folders

Private Sub OlExplprer_BeforeFolderSwitch(ByVal NewFolder As Object, Cancel As Boolean) Set OlExplprer = Application.ActiveExplorer Public WithEvents OlMailItem As Outlook.MailItem Public WithEvents OlExplprer As Outlook.Explorer And in th e Project pane, click Microsoft Outlook Objects > ThisOoutlookSession, and paste below code to right section. Press Alt + F11 keys to enable the Microsoft Visual Basic for Applications window. Tip: If you want to add all unread emails of all accounts to a folder, you can do as below steps:ġ. Now the Unread Mail folder is copied and added to your favorites at the top of Navigation Pane. Step 3: Right click the Unread Mail folder, and click the Show in Favorites item in the right-click menu. Once an unread email message is opened, it will be removed from the Unread Mail folder automatically. And all unread email messages are collected into this folder automatically. Now an Unread Mail folder is created and shows in the navigation pane. Step 2: In the New Search Folder dialog box, select and highlight the Unread mail item, and click OK.
