Applies to Microsoft Outlook 2013, Outlook 2010, Outlook 2007
This is a solution to a very popular question of how to create a Unified Inbox in Outlook 2010. It was posted in the TechNet forums by oju2. While not quite the same as a true Unified Inbox for all email accounts, it has one advantage a true unified inbox does not offer: a very easy way to filter out the mail you don't want to see in a unified view by adding additional queries to the txtSearch line in each macro.
This solution could easily be adapted to apply any frequently used search conditions to a folder.
To use, press Alt+F11 to open the VBA editor, expend Project1 and paste the code into ThisOutlookSession. Add Buttons to Your ribbon or QAT to call the macros to quickly enable the Unified Inbox search when needed. Remember: you need to have macro security set on Low, Warn, or sign the macros using SelfCert.
See How to use Outlook’s VBA Editor for complete details.
Workaround Solution:
1) Press Ctr+Alt+A
2) Type the following in the search box: folder: (Inbox) received: (this week)
3) Hit enter and you should see your Unified inbox for all mails received this week.
A more elaborate solution to automate this is to do a Macro. This is the code you need:
The code for a UNIFIED INBOX:
Sub UnifiedInbox() Dim myOlApp As New Outlook.Application txtSearch = "folder:Inbox received: (this week)" myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders Set myOlApp = Nothing End Sub
The code for a UNIFIED SENT BOX:
Sub UnifiedSentbox() Dim myOlApp As New Outlook.Application txtSearch = "folder: (Sent Mail) sent: (this week)" myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders Set myOlApp = Nothing End Sub
Valid Search Scopes
In Outlook 2010 and Outlook 2013, you can choose between the following search scopes:
| Scope | Description |
|---|---|
| olSearchScopeCurrentFolder | Limit the search to the currently selected folder. |
| olSearchScopeSubfolders | Limit the search to the currently selected folder and its subfolders. To search all folders in one data file, select the top level of the pst. |
| olSearchScopeAllFolders | Search all folders (of the current folder type). This search includes all data stores that are enabled for search. |
| olSearchScopeAllOutlookItems | Search all Outlook items in all folders in stores that are enabled for search. |
In Outlook 2007, you are limited to olSearchScopeAllFolders and olSearchScopeCurrentFolder
Create a macro for any frequently used Instant Search
You can easily use this macro to create a frequently used search and assign it to a button. You can use instant search to get the criteria then copy and paste it in txtSearch line. When a search query includes double quotes, replace them with parenthesis.
For example, category:="MTWT" becomes category:(MTWT)
Sub SearchByCategory() Dim myOlApp As New Outlook.Application txtSearch = "category:(Business)" myOlApp.ActiveExplorer.Search txtSearch, olSearchScopeAllFolders Set myOlApp = Nothing End Sub
Use this code to search (in the current folder) for mail received within the last 7 days.
Sub LastSevenDays()
Dim myolApp As New Outlook.Application
Dim tDate As Date
tDate = Now - 7
txtSearch = "received: (" & Format(tDate, "mm/dd/yyyy") & ".." & Format(Now, "mm/dd/yyyy") & ")"
myolApp.ActiveExplorer.Search txtSearch, olSearchScopeCurrentFolder
Set myolApp = Nothing
End Sub

