我正在尝试捕获日历约会对象上的 appt_Write 事件。下面的代码适用于所有情况,除非用户选择约会并一键拖动。
有没有更好的方法来设置 appt 对象,以便我可以为任何日历上的任何约会捕获 appt_Write 事件?
Private WithEvents objExplorer As Outlook.Explorer
Private WithEvents appt As Outlook.AppointmentItem
Public Sub Application_Startup()
Set objExplorer = Application.ActiveExplorer
End Sub
Private Sub objExplorer_SelectionChange()
If objExplorer.CurrentFolder.DefaultItemType = olAppointmentItem Then
If objExplorer.Selection.Count > 0 Then
Set appt = objExplorer.Selection(1)
End If
End If
End Sub
Private Sub appt_Write(Cancel As Boolean)
'Do something with Appt Object here. When a user clicks and drags,
'this write event has already fired by the time the Appt object is set.
End If
End Sub