我正在尝试捕获日历约会对象上的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
答案 0 :(得分:0)
您可以尝试在文件夹上使用Items.ItemChange事件,但只会在项目更改后触发。