Sdílet prostřednictvím


Read Event

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.

Subobject**_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

Applies to | AppointmentItem Object | ContactItem Object | DistListItem Object | DocumentItem Object | JournalItem Object | MailItem Object | MeetingItem Object | PostItem Object | RemoteItem Object | ReportItem Object | TaskItem Object | TaskRequestAcceptItem Object | TaskRequestDeclineItem Object | TaskRequestItem Object | TaskRequestUpdateItem Object

See Also | Close Method | CustomAction Event | CustomPropertyChange Event | Forward Event | Open Event | PropertyChange Event | Reply Event | ReplyAll Event | Send Method | Using events with Automation | Write Event