View Full Version : Perform Count of Incoming Emails?
Re: Outlook 2003
I've been asked to keep a record of how many emails are received in a week, I know I can do this manually (pen and paper, old school style), but there has got to be a way to some how record the number of emails received per week (per day would be even better). Is this possible?
Perhaps have the count tracked in Notepad or Excel, whatever.. All ideas welcome.
Thank you in advance for all assistance,
-Nox
Andy Pope
11-21-2008, 04:28 AM
Try this.
Sub X()
Dim objOLApp As Object
Dim objMAPI As Object
Dim objOLFolder As Object
Dim objOLMail As Object
Dim datStart As Date
Dim datEnd As Date
Dim lngCount As Long
Const olFolderInbox = 6
Set objOLApp = GetObject(, "Outlook.Application")
Set objMAPI = objOLApp.GetNamespace("MAPI")
datStart = "1/Nov/2008"
datEnd = "21/Nov/2008"
Set objOLFolder = objMAPI.GetDefaultFolder(olFolderInbox)
For Each objOLMail In objOLFolder.Items
If objOLMail.receivedtime >= datStart And objOLMail.receivedtime <= datEnd Then
Debug.Print objOLMail.receivedtime, objOLMail.Subject
lngCount = lngCount + 1
End If
Next
MsgBox lngCount & " messages between " & datStart & " and " & datEnd
Set objOLFolder = Nothing
Set objMAPI = Nothing
Set objOLApp = Nothing
End Sub
Great, I'll give that shot.
Now, if this isn't a count that is going to be in the default user inbox, how do I get it to run in a group email box?
Thank you!
Okay, actually, I don't need to do that (above).
How can I modify that code to count things from a specific person/email address?
Andy Pope
11-22-2008, 05:11 AM
You need to check other properties of the mail item such as Subject, Sender.
If you include a reference the Outlook object library, via Tools > References, you can use the object browser to see properties of outlook items.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.