我希望获得后续标记对话框,而当我关闭邮件项目时,类别对话框会提醒我自己。我引用了代码形式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
谢谢大家的任何评论!
Outlook对象模型不提供用于显示Add Reminder...
对话框的任何属性或方法。
您能做的最好的事情就是以编程方式执行内置控件:
CommandBars.ExecuteMso ("AddReminder")
但是我认为Close
事件处理程序不适合用于此类操作。