Dismiss Outlook reminder
Asked Answered
A

2

12

I am having no luck dismissing an Outlook alert programmatically before it displays.

Private Sub Application_Reminder(ByVal Item As Object)
    Dim objRem As Reminder
    Dim objRems As Reminders
    If Item.Subject = "TESTING" Then
        'downloadAndSendSpreadReport
        Set objRems = Application.Reminders
        i = 0
        For Each objRem In objRems
            i = i + 1
            If objRem.Caption = "TESTING" Then
                objRems.Remove i
                If objRem.IsVisible Then
                    objRem.Dismiss
                End If
                Exit For
            End If
        Next objRem
        Item.ReminderSet = False
        Item.Delete
        'Item.Dismiss
    End If
End Sub

I want to use this appointment Item as a trigger to some macro without needing users to manually dismiss the reminder.

Seems to me, when this event is triggered, the reminder item is NOT visible, thus cannot be dismissed

I tried to remove it from the reminders set but this seems to delete the whole event from my calendar. Also, it will still display a STRANGE TITLE reminder not in ASCII.

I tried to set the reminderSet property of the appointment item to false, the reminder property still pops up.

So I am looking for a way to a) dismiss the reminder before it pops automatically/ b). dismiss the reminder after it pops automatically....or any workaround to do a scheduled MACRO in Outlook. (Please note that I do not have permission to use scheduled job in Windows nor VBS.)

Updates:

Now I have the following code. The reminder is being removed, but it will still pop out a reminder window with a caption like "There is no appointment/reminder" something like this.

The beforeReminderShow event is useful in the sense the Reminder Object isVisible = true

so I can dismiss out.. but the reminders windows will continue to pop up even if there's 0 event.

Private WithEvents olRemind As Outlook.Reminders
Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)
Set objRems = Application.Reminders
    For Each objRem In objRems
        If objRem.Caption = "TESTING" Then
            If objRem.IsVisible Then
                objRem.Dismiss
            End If
            Exit For
        End If
    Next objRem

End Sub

[Solved] - final edit
The final solution workable (I placed in "ThisOutlookSession" Module). Hope this helps others.

' declare this object withEvents displaying all the events
Private WithEvents olRemind As Outlook.Reminders
Private Sub Application_Reminder(ByVal Item As Object)
    Set olRemind = Outlook.Reminders
    ' RUN OTHER MACRO HERE
End Sub

Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)

    For Each objRem In olRemind
        If objRem.Caption = "TESTING" Then
            If objRem.IsVisible Then
                objRem.Dismiss
                Cancel = True
            End If
            Exit For
        End If
    Next objRem

End Sub
Ardatharde answered 8/11, 2012 at 6:53 Comment(0)
S
6

The only way I know how to do this is as follows.

You need this at the top of your module/class:

Private WithEvents olRemind As Outlook.Reminders

Then when you get your Outlook object you need to do this:

Set olRemind = olApp.Reminders

Where olApp is your Outlook Application object.

Now in your code you need to have this event:

Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)

Once you put the WithEvents at the top then you will be able to see all the events you can use.

Now you can cancel this event and thus not see the reminder window.

Segmental answered 9/11, 2012 at 10:13 Comment(4)
I will give it a try on Monday, Thanks in advance. I couldn't find out the event. Thanks!Ardatharde
Upon reading your question again, I am thinking that you will have to do a combination of what you already have and my suggestion. I am thinking of a case where you want to remove a reminder but the user has other reminders. In this case you remove yours and then let the reminder window show. If yours is the only reminder then you would use the event I have suggested to stop the window showing at all.Segmental
That looks ok to me is there still a problem? Remember if you want to stop the window you have to Cancel = True in there somewhere.Segmental
Hi, so Cancel <-- is byRef? And if I set it to true INSIDE olRemind_BeforeReminderShow, it won't pop up? I am trying this nowArdatharde
R
5

If you want to dismiss all the reminders, you can simply implement the following code (declare this object WithEvents displaying all the events):

Private WithEvents olRemind As Outlook.Reminders

Private Sub Application_Reminder(ByVal Item As Object)
    Set olRemind = Outlook.Reminders
    ' RUN OTHER MACRO HERE
End Sub

Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)
    Cancel = True          
End Sub
Ropeway answered 8/4, 2013 at 10:59 Comment(1)
THanks @sparksustc, I have posted my final workable version at the end of my question. but your answer is the actual implementation of darbid's answer above.Ardatharde

© 2022 - 2024 — McMap. All rights reserved.