在预览窗格中打开电子邮件时会触发什么事件?

时间:2017-07-04 10:18:44

标签: vba outlook

我使用这样的代码来捕获电子邮件中的打开事件,但这只会在您实际双击电子邮件时触发。有没有办法在预览窗格中打开电子邮件时运行代码?

Public WithEvents myItem As Outlook.MailItem
Public EventsDisable As Boolean

Private Sub Application_ItemLoad(ByVal Item As Object)
    If EventsDisable = True Then Exit Sub
    If Item.Class = olMail Then
        Set myItem = Item
    End If
End Sub


Private Sub myItem_Open(Cancel As Boolean)
    EventsDisable = True
    'do something
    EventsDisable = False
End Sub

感谢。

1 个答案:

答案 0 :(得分:1)