I have multiples account synced on my outlook desktop app and I am looking for code to display only 2 inbox.
I am aware of the “unified method” but I tried to filter this depending on folder or mailboxes and couldnt make it to work
' This macro creates a "unified inbox" - a search across all inboxes and sent items.
' Steps to use it:
' 1. Enable developer tab to see VBA console:
' Options > Customize Ribbon >
' Enable the selection field before “Developer” and OK.
' 2. Add macro:
' From the Developer tab open Visual Basic dialog
' Open VBA Add the Sub below to General context
' 3. Enable macros:
' Options > Trust Center > Trust Center Settings > Macro Settings
' Choose 'Notifications for all macros' and OK.
' 4. Add the macro to Quick Access Toolbar:
' Options > Quick Access Toolbar
' Choose commands from 'Macros'
' Select the macro 'Project1.ThisOutllokSession.UnifiedInbox' and [add] it to the right side pane.
' Select [Modify] and choose an icon and display name. and OK.
Sub UnifiedInbox()
Dim myOlApp As New Outlook.Application
Dim tDate As Date
tDate = Date - 14 '7 days ago
txtSearch = "folder:Inbox received:(>" & tDate & ")" & " OR folder:Sent sent:(>" & tDate & ")"
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeCurrentFolder
myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders
Set myOlApp = Nothing
End Sub
New contributor
DocKS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.