0
我使用這樣的代碼從電子郵件中捕獲打開的事件,但只有當您實際上雙擊電子郵件時纔會觸發此事件。在預覽窗格中打開電子郵件時是否也有辦法運行代碼?在預覽窗格中打開電子郵件時會觸發什麼事件?
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
謝謝。