0

I need to count some mails in Outlook for Windows. There are some workarounds to do so, but the only real solution I found is to use a VBA script as described in this other question here:

How can I count the selected items in Outlook?

The problem with this solution is, that it only counts the actually visible items. When "Show as Conversations" is active, it will count any collapsed conversations as one, regardless of the actual number of mails within.

How can the VBA code be amended to count all the messages in the conversations as well?

1

1 Answer 1

0

If you want to count the number of selected messages using VBA, you can use the Selection object which represents a collection of MailItem objects.

Sub CountSelectedEmails()
Dim myOlExp As Outlook.Explorer
Dim myOlSel As Outlook.Selection
Dim MsgCount As Integer

Set myOlExp = Application.ActiveExplorer
Set myOlSel = myOlExp.Selection

MsgCount = myOlSel.Count

MsgBox "Number of selected messages: " & MsgCount, vbInformation

End Sub

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .