MailItem.Read event (Outlook)

Occurs when an instance of the parent object is opened for editing by the user.

Syntax

expression. Read

expression A variable that represents a MailItem object.

Remarks

The Read event differs from the Open event in that Read occurs whenever the user selects the item in a view that supports in-cell editing as well as when the item is being opened in an Inspector.

Example

This Visual Basic for Applications (VBA) example uses the Read event to increment a counter that tracks how often an item is read.

Public WithEvents myItem As Outlook.MailItem 
 
 
 
Sub Initialize_handler() 
 
 Set myItem = Application.ActiveExplorer.CurrentFolder.Items(1) 
 
 myItem.Display 
 
End Sub 
 
 
 
Sub myItem_Read() 
 
 Dim myProperty As Outlook.UserProperty 
 
 Set myProperty = myItem.UserProperties("ReadCount") 
 
 If (myProperty Is Nothing) Then 
 
 Set myProperty = myItem.UserProperties.Add("ReadCount", olNumber) 
 
 End If 
 
 myProperty.Value = myProperty.Value + 1 
 
 myItem.Save 
 
End Sub

See also

MailItem Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.