After selecting Alt-F11 and ThisOutlookSession [on the left sidebar], I selected "Application" and "Startup" [which is where this code is added.]
It append to a .csv file that can be opened in Excel. This is nice if you're attempting to get your inbox under control and want to track your progress.
Private Sub Application_Startup()
On Error GoTo itfailed:
' I want to be able to catch up by reading all my unread messages
Dim ns As Outlook.NameSpace
Dim folder As MAPIFolder
Dim item As Object
Dim msg As MailItem
' Open the inbox folder
Set ns = Session.Application.GetNamespace("MAPI")
Set folder = ns.GetDefaultFolder(olFolderInbox)
myfolder = Environ$("USERPROFILE") & "my documents"
myfile = "outlookunread.csv"
Open myfolder & myfile For Append As 1
Print #1, Strings.Format(Now, "Short Date") + " " + Strings.Format(Now, "Long Time") + "," + CStr(folder.UnReadItemCount) + "," + CStr(folder.Items.Count)
MsgBox Err.Description, vbCritical, Err.Number
The space allowed for rules is VERY limited. You can have roughly 40 rules active at a time [sometimes far fewer]. It's best to lump all the sorting of one specific type into the same rule, because the search terms do not seem to take up as much space as the rules themselves do.
While you can right-click and "Create Rule..." on every message type you want to filter, you will run out of rules space very quickly. Maybe in minutes.
I worked through some rules that helped greatly reduce the amount of newsletters, etc., that show up in my in my main inbox.
I started by creating a new rule [Tools->Rules and Alerts->New Rule...]
I started from a blank rule...
Next, I needed to match messages "with specific words in the subject or body". [Really just the message body]
Click on the "specific words" text to bring up a pop-up where you can specify the words.
Type words in an click "add" until you've added all the phrases to search for:
Next, check "move it to the specified folder" and click the word "specified" in the bottom part to tell Outlook where to send the messages.
Optionally, you can specify exceptions [such as internal e-mails].
Be sure to check the rule's checkbox in the "Rules and Alerts" window to enable it.
If you want to run your newly created rule on existing messages, click [Apply] then [Run Rules Now...] and check the rule to run.