Hello,
I would like a macro that pops up a window asking if I want to flag a message for follow up each time I send a message. I want the flag on my end so I will automaticlly see it in my tasks lists and remember to follow up if I have not received an answer.
Here is what I have.
Option Explicit
Private WithEvents olSentItems As Items
Private Sub Application_Startup()
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 olSentItems_ItemAdd(ByVal Item As Object)
On Error Resume Next
Dim prompt As String
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 in 3 days
.TaskDueDate = Now + 3
.ReminderSet = True
.ReminderTime = Now + 2
.Save End With
End If End Sub
I get a sytax error at "Set objNS = Nothing End Sub"
I am running office 2010.
Thanks in advance.
Bookmarks