Outlook has an option to show either the number of unread messages or the total number of messages in a folder.
To change the setting, you right click on the folder, choose Properties then select the desired option, Show number of unread items or Show total number of items.
If you have a large number of folders to change, this task can take a lot of time as you need to change the property on each folder one at a time. You can speed this up using a VBA macro.
If you have multiple data files in your profile and want to change the setting for just one data file, you'll need to use an If statement to check for the data file name. The data file name is the top folder in the folder list and listed in the Properties dialog (in the Location field) when you view the Properties of any folder, as seen in the Properties screenshot above.
After running the macro, select the data file name to refresh the view. All folders, including subfolders, will be updated.
Sub TotalUnreadCount() ' store is a pst file Dim App As New Outlook.Application Dim Stores As Outlook.Stores Dim Store As Outlook.Store Dim Root As Outlook.Folder On Error Resume Next Set Stores = App.Session.Stores For Each Store In Stores Set Root = Store.GetRootFolder ' Use If statemnet to apply to a specific data file ' Otherwise, all folders in ALL data files in the profile are changed ' display name is in the location field of the Properties dialog 'If Root = "data file display name" Then ChangeShowCount Root 'End If Next End Sub Private Sub ChangeShowCount(ByVal Root As Outlook.Folder) Dim Folders As Outlook.Folders Dim Folder As Outlook.Folder Dim Foldercount As Integer On Error Resume Next Set Folders = Root.Folders Foldercount = Folders.Count If Foldercount Then For Each Folder In Folders 'ShowTotal Count Folder.ShowItemCount = olShowTotalItemCount 'Show UnreadCount 'Folder.ShowItemCount = olShowUnreadItemCount ChangeShowCount Folder Next End If End Sub
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor
More Information
Store.GetRootFolder Method (Outlook) (MSDN)
Store Object (MSDN)
Is there a way to remove folder counter in Outlook 365 desktop without a macro?
so no numbers show? No... unless you mark all read. That is possible to do using code (but I don't think I have a code sample.)
this worked like a charm. so getting around issue with all view ... which obviously does NOT incl that setting in Views
nonethe less, this should NOT have been necessary! MS should have included such a basic and necessary function from the start.
all these years and tey STILL get get it right!
which brings me to my next task - delete all empty folders :-)
>>
which brings me to my next task - delete all empty folders :-)
<<
I should have a macro for that. Or not... I have macro here but they don't check the item count.
Delete folders using a macro or PowerShell (slipstick.com)
I'll see if I have one I didn't publish and publish it on that page... or edit the scripts to check the folder count.
thanks so much.
these simple and critical functions that are still simply misssing after so many years
so much time and effort wasted on functions and tasks that should have been 'baked in' from the start (or 1st revision); and yet here we are YEARS (AND YEARS) later, and MS still don't do it or 'get it'.
i am old enough and been around long enough to very fondly remember (Novell) GroupWise. what a terrific email program/app! it was better in its first iteration, about 20 years ago, than Outlook is. As was the whole Novell suite than anything MS have ever done.
Hi Diane
none of those scripts seem to simply delete all the existing empty folders. i found a couple of other VBA scripts that are supposed to do that, but have a bug/error when i run on my files.
but at least now i have global 'Total Items' in display i can identify which Folders ARE empty (and can manually delete).
btw, i wonder how many times in the past i deleted Folders that were NOT empty because i forgot that they were NOT displaying the Total Items count?
related to this, i have issues/questions arising after i merged PST files .... i will post separately :-)
Simple and necessary function. Not proposed as a basic in outlook.
GREAT thanks to the author, congratulation;
as usual i not proud on the microsoft tool, Microsoft is no longer user oriented for efficiency, more oriented to grow in cheaper developpement and publish low real added value software
Worked great! Thanks Diane.
My apologies. I wrote too soon. I figured out how to reverse this. Thank you again. Very helpful script!
How did you reverse this? Ran the macro and it worked perfectly, now I just need to undo it
What's the trick to reverse this?
Rerun it - changing which line is commented out:
'ShowTotal Count
' Folder.ShowItemCount = olShowTotalItemCount
'Show UnreadCount
Folder.ShowItemCount = olShowUnreadItemCount
ChangeShowCount Folder
Thank you so much! Glad to know there's an undo button. Was a bit worried there for a second.
Hi Diane,
the macro worked great. Thanks much,
Phillip