Count Selected Items macro

Count Selected buttonOutlook’s Status Bar can show how many items you have in a specific folder and also how many of those items are unread. However, a much requested feature is also have it reveal how many items have been selected.

Unlike File Explorer, Outlook doesn’t hold this option. The closest Outlook has to offer is a workaround where you press ENTER “pretending” to open all these selected items at once. In this case Outlook will warn you about how many items you are trying to open and offers you to cancel the action.

More about this workaround can be found in the MSOutlook.info Quick Tip; Count selected items

In that tip I also mention that whipping up some VBA code for it is not that hard to do. Using a VBA method to count your selected items might be preferred over the mentioned workaround as it won’t have the risk of (accidentally) actually opening all the selected items at once and cause Outlook to hang.

In this guide I’ll provide you with this code and instructions on how to implement it.


CountSelectedItems macro

Visual Basic buttonThe CountSelectedItems macro allows you to find out how many items you have selected in a folder. This will work in any folder and in any View.

The result is shown in a dialog box.

Message box output of the macro.
Message box output of the macro.

Quick Install

  1. Download this code-file (countselected.zip) or copy the code below.
  2. Open the VBA Editor (keyboard shortcut ALT+F11)
  3. Extract the zip-file and import the CountSelected.bas file via File-> Import…
    If you copied the code, paste it into a new module.
  4. Sign your code so you won’t get any security prompts and the macro won’t get disabled.
  5. Add a button for easy access to the macro or press ALT+F8 and select the macro you want to execute.

Count Selected Items macro via the Magic 8-Ball button
I recommend using the Magic 8-Ball icon for this macro button.

Macro code

The following code is contained in the zip-file referenced in the Quick Install. You can use the code below for review or manual installation.

Sub CountSelectedItems()
    Dim objSelection As Outlook.Selection
    Dim Result As Integer
    Set objSelection = Application.ActiveExplorer.Selection
    Result = MsgBox("Number of selected items: " & _ 
                objSelection.Count, vbInformation, "Selected Items")
End Sub