Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select only Current Day

Status
Not open for further replies.

robcarr

Programmer
May 15, 2002
633
GB
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top