Hello,
I have the following macro:
Option Explicit
Private WithEvents olSentItems As Items
Private Sub Application_MAPILogonComplete()
Dim objNS As NameSpace
Set objNS = Application.Session
' instantiate objects declared WithEvents
Set olSentItems = objNS.GetDefaultFolder(olFolderSentMail).Items
Set objNS = Nothing
End Sub
Private Sub Application_Startup()
End Sub
Private Sub olSentItems_ItemAdd(ByVal Item As Object)
On Error Resume Next
Dim prompt As String
Dim objRecip As Recipient
Set objRecip = Item.Recipients.Add
prompt$ = "Do you want to flag this message for followup?"
If MsgBox(prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Add flag?") = vbYes Then
With Item
.MarkAsTask olMarkThisWeek
' sets a due date for tomorrow
.TaskDueDate = Now + 1
.ReminderSet = True
.ReminderTime = Now + 1
.Save
End With
End If
End Sub