【问题标题】:Open “Add reminder” dialog for mail item by Close event通过关闭事件打开邮件项目的“添加提醒”对话框
【发布时间】:2020-09-09 15:06:27
【问题描述】:

我想在我关闭邮件项时获取后续标志对话框和类别对话框以设置提醒。
我试图从here 修改代码。当我关闭一个邮件项目时,一切都保持正常,我得到了类别对话框。我无法获得this 等后续标志的对话框。没有错误消息弹出。

Public WithEvents objInspector As Outlook.Inspector
Public WithEvents colInspectors As Outlook.Inspectors

Private Sub Application_Startup()
    Init_colInspectorsEvent
End Sub

Private Sub Application_ItemLoad(ByVal Item As Object)
    Init_colInspectorsEvent
End Sub

Private Sub Init_colInspectorsEvent()
    'Initialize the inspectors events handler
    Set colInspectors = Outlook.Inspectors
End Sub

Private Sub colInspectors_NewInspector(ByVal NewInspector As Inspector)
    If NewInspector.CurrentItem.Class = olMail Then MsgBox "New mail inspector is opened"
    If NewInspector.CurrentItem.Class = olTask Then MsgBox "New Task inspector is opened"
    If NewInspector.CurrentItem.Class = olContact Then MsgBox "New Contact inspector is opened"
    Set objInspector = NewInspector
End Sub

Private Sub objInspector_Close()
If objInspector.CurrentItem.Class = olMail Then 'MsgBox "Mail inspector is closing"
    objInspector.CurrentItem.ShowCategoriesDialog
    objInspector.CommandBars.ExecuteMso ("AddReminder") 'No error but not work
    objInspector.CurrentItem.Save
End If
End Sub

【问题讨论】:

  • 为什么需要在inspector窗口关闭后立即显示一个对话窗口?
  • @Eugene Astafiev 这是一个聪明的问题。因为我想强迫自己在工作流程中考虑邮件项目的优先级。我有一个习惯,我想打开收件箱的邮件,但我不一定有时间立即处理,所以我需要给自己一个提醒或跟进标记收到的邮件,如果需要。

标签: vba events outlook dialog


【解决方案1】:

Outlook 对象模型不提供用于显示Add Reminder... 对话框的任何属性或方法。

您可以做的最好的事情是以编程方式执行内置控件:

CommandBars.ExecuteMso ("AddReminder")

但我认为Close 事件处理程序不适合处理此类事情。

【讨论】:

  • 在搜索了一些信息后,我还发现MS没有提供像ShowCategoriesDialog这样的添加提醒对话框。此外,如果您的意思是我不能在关闭事件中使用CommandBars.ExecuteMso ("AddReminder") 的脚本?
  • Close 事件处理程序不是调用 UI 内置按钮/控件的正确位置。我们不能确定他们还活着。所以,这就是为什么它有时有效,有时无效。没有人能保证检查器 UI 仍然可以访问且不会被破坏。
猜你喜欢
  • 2018-05-26
  • 1970-01-01
  • 2021-11-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-08
  • 1970-01-01
相关资源
最近更新 更多