Sub CountInboxSubjects()
Dim olApp As Outlook.Application
Dim olNs As Outlook.Namespace
Dim olFldr As Outlook.MAPIFolder
Dim propertyAccessor As Outlook.propertyAccessor
Dim olItem As Object
Dim dic As Dictionary
Dim i As Long
Dim Subject As String
Dim data
Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set olFldr = olNs.GetDefaultFolder(olFolderInbox)
Set dic = New Dictionary
For Each olItem In olFldr.Items
If olItem.Class = olMail Then
Subject = olItem.Subject
If dic.Exists(Subject) Then
data = Split(dic(Subject), "|")
data(0) = data(0) + 1
If olItem.ReceivedTime > CDate(data(1)) Then data(1) = olItem.ReceivedTime
dic(Subject) = Join(data, "|")
Else
dic(Subject) = 1 & "|" & olItem.ReceivedTime
End If
End If
Next olItem
With ActiveSheet
.Columns("A:C").Clear
.Range("A1:C1").Value = Array("Count", "Subject", "Date")
For i = 0 To dic.Count - 1
data = Split(dic.Items()(i), "|")
.Cells(i + 2, "A") = data(0)
.Cells(i + 2, "B") = dic.Keys()(i)
.Cells(i + 2, "C") = CDate(data(1))
Next
End With
End Sub