在按下发送按钮后,是否有办法询问(弹出)是否要标记电子邮件?
谢谢
答案 0 :(得分:1)
使用Application.ItemSend事件显示MsgBox
,询问是否进行标记。
然后,如this question中所述,您需要在“已发送邮件”文件夹中侦听Items.ItemAdd
事件,并在传递给事件处理程序的消息上调用MarkAsTask
。
因此,将以下代码添加到ThisOutlookSession
-使用 Alt + F11 来打开VB编辑器。
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim SentItems As Folder
Set SentItems = Outlook.Application.GetNamespace("MAPI").GetDefaultFolder(olFolderSentMail)
Set Items = SentItems.Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
Dim property As UserProperty
Set property = Item.UserProperties("FlagForFollowUp")
If property Is Nothing Then Exit Sub
Item.MarkAsTask olMarkThisWeek
Item.Save
End If
End Sub
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If TypeOf Item Is Outlook.MailItem Then
Dim prompt As String
prompt = "Would you like to flag this item?"
If MsgBox(prompt, vbYesNo + vbQuestion, "Flag item") = vbYes Then
Dim property As UserProperty
Set property = Item.UserProperties.Add("FlagForFollowUp", olYesNo)
property.Value = True
End If
End If
End Sub