Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Office > Outlook

LinkBack Thread Tools Display Modes
Old 03-29-2019, 11:33 PM
Outlookmess Outlookmess is offline Windows XP Office 2010
Join Date: Mar 2019
Posts: 2
Outlookmess is on a distinguished road
Default Daily incoming email count report

Is it possible to get a report of incoming emails, number of emails per day, number of emails per month for a certain per etc?

Basically I am getting too many emails per day/month and want to analyse where the emails are coming from so to put in control measures.
Reply With Quote
Old 03-30-2019, 02:30 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Join Date: Aug 2014
Posts: 2,706
gmayor is just really nicegmayor is just really nicegmayor is just really nicegmayor is just really nice

You could use a script to log the time the messages arrive and who they are from using a two column Excel worksheet with a header row and the following code run from a rule that acts on all incoming messages. I have included a macro to test it with a selected message. You will need to create your own worksheet and change the workbook name as appropriate.

Option Explicit
Const strWorkBook As String = "C:\Path\EMailLog.xlsx"    '- two column worksheet (Sheet1) with header row

Sub TestCode()
Dim olMsg As MailItem
    On Error Resume Next
    Set olMsg = ActiveExplorer.Selection.Item(1)
    LogEMails olMsg
    Exit Sub
End Sub

Sub LogEMails(olItem As MailItem)
Dim strAddress As String
Dim strDate As String
    strDate = olItem.ReceivedTime
    strAddress = olItem.SenderEmailAddress
    LogToExcel strWorkBook, strAddress, strDate
    Exit Sub
End Sub

Private Function LogToExcel(strWorkBook As String, _
                            strAddress As String, _
                            strDate As String)

Dim ConnectionString As String
Dim strSQL As String
Dim CN As Object
    ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
                       "Data Source=" & strWorkBook & ";" & _
                       "Extended Properties=""Excel 12.0 Xml;HDR=YES;"";"
    strSQL = "INSERT INTO [Sheet1$] VALUES('" & strDate & "', '" & strAddress & "')"
    Set CN = CreateObject("ADODB.Connection")
    Call CN.Open(ConnectionString)
    Call CN.Execute(strSQL, , 1 Or 128)
    Set CN = Nothing
    Exit Function
End Function
Graham Mayor - MS MVP (Word)
Visit my web site for more programming tips and ready made processes
Reply With Quote

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to count unique names appeared on specific date for daily report? specky_ Excel 5 02-19-2019 02:26 AM
Automated Send of Email Message Daily meppwc Outlook 1 08-17-2015 06:08 AM
Creating Daily report forms DaveServo Excel 4 05-20-2011 03:38 AM
I'd like to email my daily agenda to me and my assistant automatically aarons Outlook 0 05-05-2011 06:15 AM
Outlook 03: automatic categorize incoming email Alex Rogo Outlook 3 02-10-2009 11:27 PM

All times are GMT -7. The time now is 08:48 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc. is not affiliated with Microsoft