Identify Number of email messages opened

Not open for further replies.

Iqbal Khan

New Member
Outlook version
Outlook 2013 64 bit
Email Account

I am trying to identify the number of email messages opened by a user.

I am using "Application_ItemLoad" event to assign myitem as opened email message.

Private Sub Application_ItemLoad(ByVal item As Object)
If item.Class = olMail Then
Set myItem = item
End If
End Sub

With the above code the current item is assigned as myitem. I am triggering a data upload event when I close the mailitem. Hence the trigger happens only when the last email is closed and for the other email messages nothing happens.

Private Sub myItem_close(Cancel As Boolean)
Modupdata.uploadviewed (vtime)
msg.Close olDiscard
MsgBox "Data captured"
If EmailDetails.Visible = True Then
End If
End If
End Sub

Please help.

so you are keeping a running count of opened messages and when the last one is closed, you want to upload the count?

not sure i under stand the other messages part of this
the last email is closed and for the other email messages nothing happens
Thank you for response.

I am uploading the email message related data to a database like email received time etc.

With my code the MyItem changes every time I open an email from outlook. And the last email message opened is myItem. So when I close the last email message the Item_close get triggered and upload the data related to the email. However for the other email messages which were opened earlier the Item_close will not trigger.

Hope that I am clear now.
Are you tracking how long they are open or just that the message was opened?

You need to keep count of the number of times you set myitem, track the subjects of open windows, or upload the data when you open the message.
Yes, I am tracking the time the email message was viewed.

Please let me know how do I trigger the Item_Close event for all the email message windows.

that is more complicated than i normally support and would probably work best compiled into an Addin.

what might be better is to set a custom field on the message when the message is open that has the opened time and use that to calculate the time when it is closed... that avoids problems with multiple messages open.
Thank you, Diane.

Thanks Michael for the response, that was useful. :)
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S VBA to identify a specific email and copy the attachment from it to the network Outlook VBA and Custom Forms 4
M Best way to identify/designate contacts in incoming emails? Using Outlook 4
makinmyway How can I easily identify and delete from my contacts defunct email addresses? Using Outlook 2
G How can I identify in VBA if the current window is an item or a folder? Using Outlook 3
S Identify weekend from daily RecurrencePattern Outlook VBA and Custom Forms 2
S Identify Read Recepits Outlook VBA and Custom Forms 7
H Better way of writing Macro? Identify multiple types of attachmen Outlook VBA and Custom Forms 5
D How to identify a mail item from a public folder in MS Outlook Outlook VBA and Custom Forms 5
S Correct way to Identify is Mail is opened in Edit Mode Outlook VBA and Custom Forms 1
J Action based on number of emails after sort by from Using Outlook 5
O Add Day Number of the year for 2023-2033 Outlook VBA and Custom Forms 5
W The number one raw material applied in producing the duvet, is clean and slight to your pores Using Outlook 0
T Increasing the number of items that appear on the Categories list Using Outlook 2
TomHuckstep Outlook 2016 Limit the number of days syncing from Google Calendar Using Outlook 1
F How to create phone number as links in notes of Contacts Using Outlook 2
I Outlook 2016 Outlook Requesting Phone Number??? Using Outlook 1
C Calculating Week Number into a TextBox Outlook VBA and Custom Forms 0
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1
O How to display number of items per .pst file Using Outlook 7
S Show Total Number Of Items Not Displaying Using Outlook 9
J Saving attachments from specific sender (phone number) to specific folder on hard drive Using Outlook 3
J How to Fix “Encounter a large number of conflict items in Exchange OST file” Using Outlook 2
S Subject add ticket number from URL query Outlook VBA and Custom Forms 2
Diane Poremsky Add a file number or keyword to the subject line of messages Using Outlook 0
K Append subjectline based on number Using Outlook 4
B ...administrator has limited the number of items you can open simultaneously Outlook VBA and Custom Forms 7
snhnic Macro that does not overwrite but add a number Outlook VBA and Custom Forms 1
L Outlook 2007 Fix Phone Number Using Outlook 19
A Calendar List View Showing Week Number Using Outlook 1
neobite Maximum number of Exchange accounts in an Outlook profile Using Outlook 4
P Country name no longer shows in Phone number popup? Using Outlook 5
Edaniels Adding Week Number on Calender Using Outlook 2
P Outlook 2013 Phone Number Format Using Outlook 0
E Outlook VBA to print attached Pdf to a fax printer and assign fax number Using Outlook 0
D Journal problem recording correct phone number Using Outlook 7
A Assign a unique number to every message I send Using Outlook 0
S Outlook - Reset the number of day-events Using Outlook 0
Z assign unique number email Using Outlook 8
M Automatically highlight unread mail in Favorites inbox(s) (Blue number) Using Outlook 1
D Journal to show Phone Number dialled. Using Outlook 3
B Llimit the number of people accepting one of the "pick a date" meeting Using Outlook 1
O BCM 2010 - Customize a field with a consecutive number? BCM (Business Contact Manager) 1
G Change length of phone number in contacts Using Outlook 5
R printing custom number of calendar days in weekly view format Using Outlook 1
J Ho do I hide the week number on the Calendar Printing Assistant template Using Outlook 4
S Persistent nuisance number Using Outlook 4
A Need method to rapidly correct telephone contact telephone number formatting Using Outlook 1
R NUMBER Format Using Outlook 0
M Mail in HTML format can't be sent if url or number is in the body Outlook 2010 Using Outlook 2
A How do I get Outlook to stop adding a "+1" in front of a telephone number that has an extension. Using Outlook 13

Similar threads