Setting the Reminder flag in VBA for e-Mails sent to users

D

Deggsie

I'm trying to programmatically send an e-Mail to a given recipient and set
the Follow-Up and Reminder flag to remind the recipient to deal with the
e-Mail by a certain date.

I've trawled the web for how-to's and got a function working, but it simply
isn't setting the reminder flag on the e-Mail.

The function I wrote allows me to pass various parameters and, based on
whether or not the mail is to be flagged for follow-up, flags the mail.

Code is attached below. If anyone can help me out, I'd appreciate it.

Public Sub SendMail(sTo As String, sCC As String, sBCC As String, sSubject
As String, sBody As String, iImportance As Integer, bSetFlag As Boolean,
vFlagDueBy As Variant, bViewMsg As Boolean)

Dim strBodyText As String, vDate As Variant



Dim olApp As Outlook.Application

Dim olNS As Outlook.NameSpace

Dim olFolder As Outlook.MAPIFolder

Dim olMailItem As Outlook.MailItem



Set olApp = CreateObject("Outlook.Application")

Set olNS = olApp.GetNamespace("MAPI")

Set olFolder = olNS.GetDefaultFolder(olFolderInbox)

Set olMailItem = olFolder.Items.Add("IPM.Note")

' Set olMailItem = Item



With olMailItem

.To = sTo

.CC = sCC

.BCC = sBCC

.Subject = sSubject

.Body = sBody

.Importance = iImportance

Select Case bSetFlag

Case True

.FlagStatus = olFlagMarked

.FlagIcon = olRedFlagIcon

.FlagDueBy = vFlagDueBy

.ReminderOverrideDefault = True

.ReminderSet = True

End Select

Select Case bViewMsg

Case True

.Display ' shows e-Mail to the user for confirmation/editing

Case Else

.Save

.Send ' send the e-Mail without user interaction

End Select

End With



Set olMailItem = Nothing

Set olFolder = Nothing

Set olNS = Nothing

Set olApp = Nothing

End Sub
 
J

JP

Have you tried stepping through the code to see if the reminder/flag
is being set on the email?

Why aren't you setting the MailItem.ReminderTime property?

Why is vFlagDueBy a Variant (not Date) type?

If nothing works, my guess would be that (just like Tasks) you can't
set a reminder on someone else's computer.

--JP
 
D

Deggsie

Hi JP,

Have you tried stepping through the code to see if the reminder/flag
is being set on the email?
Yup, and it's being set.
Why aren't you setting the MailItem.ReminderTime property?
I am doing now.
Why is vFlagDueBy a Variant (not Date) type?
It didn't make a difference either way as I'm passing a date into this
parameter anyway.
If nothing works, my guess would be that (just like Tasks) you can't
set a reminder on someone else's computer.
And that could be the issue all along.
I've been working with Tasks as well, but my issue with those was that I
couldn't avoid the task being created on my machine before it was 'allocated'
to someone else. Which also led to me getting updates on when the task was
closed, etc.

The reason I need this task/e-Mail thing to work is that the 'system issues'
are raised by one individual and then passed to recipients to deal with. The
recipient's boss is also notified that the recipient has an outstanding job
and the target date for completion (less two days) is what I was hoping to
use for the reminder flag.

Thanks for your suggestions anyway.
 
S

Sue Mosher [MVP]

When I ran your code, the message arrived with a flag but no reminder. I
think it's by design that it doesn't carry a reminder. Early versions of
Outlook could do that -- make a reminder fire on a recipient's machine --
which offered the potential for an annoying of spam and other intrusiveness.
Now, it's up to users to decide when to set a reminder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top