Read Event

Microsoft Outlook Visual Basic

Occurs when an existing Microsoft Outlook item is opened for editing by the user. 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.

Sub object_Read()

object An object that evaluates to one of the objects in the Applies To list. In Microsoft Visual Basic Scripting Edition (VBScript), use the word Item.

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 + 2
    myItem.Save
End Sub