how to dismiss a reminder after sending a recurring email via vba?

0

I was able to create a recurring email via a code in vba that triggers every time that a reminder with a certain category fires.

http://www.slipstick.com/developer/send-email-outlook-reminders-fires/

My question, is how do I dismiss the reminder after the email is send? when I add the line reminders(1).Dismiss the code breaks at that point.

if I continue with the execution of the reminder finally appears in outlook.

It appears that the application reminders macro needs to finish to be executed in order to dismiss reminder event.

user61651

Posted 2015-08-04T02:06:43.133

Reputation: 1

Answers

1

Just had this issue myself. j_foster's idea seems to work well. However it's better to use the Entry ID of the appointment item to identify the index of the notification. Then one can use remove().

See below:

Private Sub Application_Reminder(ByVal Item As Object)
    If TypeOf Item Is AppointmentItem Then
        'Do Something...

        'Loop over all reminders and find index of appt
        Dim appt As AppointmentItem: Set appt = Item
        Dim i As Integer: i = 0
        Dim notif As reminder
        For Each notif In Application.Reminders
            i = i + 1
            If notif.Item.EntryID = appt.EntryID Then
                Call Application.Reminders.Remove(i)
                Exit For
            End If
        Next
    End If
End Sub

Sancarn

Posted 2015-08-04T02:06:43.133

Reputation: 111

0

According to the MSDN the Applcation.Reminder event used Slipstick's macros is executed before the reminders dialog appears. But the Reminder.Dismiss method requires that a reminder (not sure if it has to be the same one) is already displayed in the reminder dialog. That's why this is not working. That said, AFAIK there's no guarantee that Reminders(1) will be the reminder that just fired; you may be trying to dismiss the wrong reminder.

As a possible solution (which I must emphasize, I have not tested), try using Reminders.Remove(Item.Subject). The documentation seems to indicate that Reminders.Remove requires the numerical index, but it's worth a try. Also, if two items with reminders have the same subject, there's no guarantee that you'll get the right one.

j_foster

Posted 2015-08-04T02:06:43.133

Reputation: 336