If its not listed, add C:\Windows\System32\FM20.dll or C:\Windows\FM20.dll as a reference. If you receive a "User-defined type not defined" you are missing the reference to Microsoft Forms 2.0 Object Library. TxtSearch = "received: (" & tDate & "." & Date & ") " & strPasteĭon't forget to set a Reference to the Forms library. Combine it with predefined search terms like this:
How to see two email accounts in outlook code#
Merged with the code to paste the clipboard contents into a message from " Paste clipboard contents using VBA", this string sample would search for the text that is on the clipboard. Or enter the dates, in short date format of m/d/yy or m/d/yyyyĭaysno = InputBox("Enter the dates, separated with a comma, the oldest date first") Txtsearch = "folder:Inbox received:" & date1 & "." & date2 You can use an Inputbox to enter the values to count back:ĭaysno = InputBox("Enter the days, separate with comma, the larger number first") To find messages between two dates, use this string: TxtSearch = "folder:Inbox received: (>" & tDate & ")" Use this code to search (in the current folder) for mail received within the last 7 days. When a search query includes double quotes, replace them with parenthesis.įor example, category:="MTWT" becomes category:(MTWT) You can use instant search to get the criteria then copy and paste it in txtSearch line. You can easily use this macro to create a frequently used search and assign it to a button. In Outlook 2007, you are limited to olSearchScopeAllFolders and olSearchScopeCurrentFolder Create a macro for any frequently used Instant Search Search all Outlook items in all folders in stores that are enabled for search. This search includes all data stores that are enabled for search. Search all folders (of the current folder type). To search all folders in one data file, select the top level of the pst. Limit the search to the currently selected folder and its subfolders. Limit the search to the currently selected folder. In Outlook 2010 and newer you can choose between the following search scopes: Scope TxtSearch = "folder: (Sent Mail) sent: (this week)" TxtSearch = "folder:Inbox received: (this week)" So we can resolve this by doing a simple global query:ġ) Type the following in the search box: folder: (Inbox) received: (this week)Ģ) Press Ctr+Alt+A to or click All Mailboxes button (Outlook 2013) or All Mail Folders (Outlook 2010).ģ) Hit enter and you should see your Unified inbox for all mails received this week.Ī more elaborate solution to automate this is to do a Macro. So this is the same as querying your Inboxes.
How to see two email accounts in outlook how to#
See How to use Outlook’s VBA Editor for complete details.įirst let's agree that Unified Inbox is no more than a particular "VIEW" of your Inbox mails on different account. Remember: you need to have macro security set on Low, Warn, or sign the macros using SelfCert. Add Buttons to Your ribbon or QAT to call the macros to quickly enable the Unified Inbox search when needed. To use, press Alt+F11 to open the VBA editor, expend Project1 and paste the code into ThisOutlookSession. This solution could easily be adapted to apply any frequently used search conditions to a folder. 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. It was posted in the TechNet forums by oju2. This is a solution to a very popular question of how to create a Unified Inbox in Outlook 2010.