任何一个人知道,如果有可能当用户更改在Outlook 2016“发件人”地址下拉挂钩到事件:展望事件:在变化“从地址”
据测试了一些VBA宏事件Application.ItemLoad
和Application.ItemSend
等。我已经得到了,但我希望有更多的事件,我可以挂接到。
任何一个人知道,如果有可能当用户更改在Outlook 2016“发件人”地址下拉挂钩到事件:展望事件:在变化“从地址”
据测试了一些VBA宏事件Application.ItemLoad
和Application.ItemSend
等。我已经得到了,但我希望有更多的事件,我可以挂接到。
当然 - MailItem.PropertyChange
事件将触发:
PropertyChange ("SendUsingAccount")
PropertyChange ("SentOnBehalfOfName")
你可以看到现场活动中OutlookSpy - 打开新的项目,点击OutlookSpy丝带项目按钮,转到事件选项卡 - OutlookSpy将记录他们被提出的事件。
MailItem类的PropertyChange事件在实例的显式内置属性(例如Subject)更改时触发。请注意,一旦更改UI中的值,您可能不会立即触发事件。在将焦点移至其他字段或保存项目之前,Outlook可能不会触发事件。
为了完整 - 这里是完整的代码,我已经实现了拍摄,我有兴趣的事件
Dim WithEvents myInspector As Outlook.Inspectors
Dim WithEvents myMailItem As Outlook.MailItem
Private Sub Application_Startup()
Set myInspector = Application.Inspectors
End Sub
Private Sub myInspector_NewInspector(ByVal Inspector As Outlook.Inspector)
If TypeOf Inspector.CurrentItem Is MailItem Then
Set myMailItem = Inspector.CurrentItem
End If
End Sub
Private Sub myMailItem_PropertyChange(ByVal Name As String)
' Properties we are interested in: "SendUsingAccount"/"SentOnBehalfOfName"
' Both get fired when the 'From' field is changed/re-selected
' So we are only going to trigger on one event or we will call the code twice
If Name = "SentOnBehalfOfName" Then
MsgBox myMailItem.SentOnBehalfOfName
End If
End Sub
。