单击并拖动约会对象时如何在VBA中捕获Appt_Write事件 [英] How to Capture Appt_Write Event in VBA when Appointment Object is Clicked and Dragged at the Same Time

查看:76
本文介绍了单击并拖动约会对象时如何在VBA中捕获Appt_Write事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试捕获日历约会对象上的appt_Write事件.下面的代码适用于除用户选择约会并将其拖动到一键时以外的所有情况.

I am trying to capture the appt_Write event on calendar appointment objects. The code below works well for every case EXCEPT when a user selects the appointment and drags it in one click.

是否有更好的方法来设置appt对象,以便我可以捕获任何日历上任何约会的appt_Write事件?

Is there a better way to set the appt object so that I can capture the appt_Write event for any appointment on any calendar?

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

推荐答案

您可以尝试在文件夹上使用Items.ItemChange事件,但仅在更改项目后才会触发.

You can try to use Items.ItemChange event on the folder, but it only fires after the item is changed.

这篇关于单击并拖动约会对象时如何在VBA中捕获Appt_Write事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆