Dear All,
I have the coding below to count all emails in each subfolder in my Inbox in Outlook, what I would like to do is count only emails received on a certain day, I am not sure how to do this, any help on this would be greatly appreciated.
Application.ScreenUpdating = False
Dim objApp As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder
Dim fldInbox As Outlook.MAPIFolder
Dim mi As Outlook.MailItem
Dim unreadm As Integer, readm As Integer
Set objApp = GetObject(, "Outlook.Application"
Set ns = objApp.GetNamespace("MAPI"
Set fldInbox = ns.GetDefaultFolder(6)
For Each fld In fldInbox.Folders
unreadm = 0: readm = 0
For Each mi In fld.Items
If mi.UnRead Then
unreadm = unreadm + 1
Else
readm = readm + 1
End If
Next
Sheets("Email Data"
.Select
Range("a1"
.End(xlDown).Offset(1, 0).Select
ActiveCell = fld.Name
ActiveCell.Offset(0, 1).Value = "="
ActiveCell.Offset(0, 2).Activate
ActiveCell = unreadm
ActiveCell.Offset(0, 1).Activate
ActiveCell = readm
Next
Thanks Thanks Rob.![[yoda] [yoda] [yoda]](/data/assets/smilies/yoda.gif)
I have the coding below to count all emails in each subfolder in my Inbox in Outlook, what I would like to do is count only emails received on a certain day, I am not sure how to do this, any help on this would be greatly appreciated.
Application.ScreenUpdating = False
Dim objApp As Outlook.Application
Dim ns As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder
Dim fldInbox As Outlook.MAPIFolder
Dim mi As Outlook.MailItem
Dim unreadm As Integer, readm As Integer
Set objApp = GetObject(, "Outlook.Application"
Set ns = objApp.GetNamespace("MAPI"
Set fldInbox = ns.GetDefaultFolder(6)
For Each fld In fldInbox.Folders
unreadm = 0: readm = 0
For Each mi In fld.Items
If mi.UnRead Then
unreadm = unreadm + 1
Else
readm = readm + 1
End If
Next
Sheets("Email Data"
Range("a1"
ActiveCell = fld.Name
ActiveCell.Offset(0, 1).Value = "="
ActiveCell.Offset(0, 2).Activate
ActiveCell = unreadm
ActiveCell.Offset(0, 1).Activate
ActiveCell = readm
Next
Thanks Thanks Rob.
![[yoda] [yoda] [yoda]](/data/assets/smilies/yoda.gif)