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
Select File > Options > Advanced. In the Reminders section, select Automatically dismiss reminders for past events.
The reminders folder or the reminder view is corrupted. A sync conflict may also prevent Outlook from dismissing a reminder.
In the Calendar view, select the specified calendar folder where you will retrieve multiple dismissed reminders, and click View > Change View > List.
Dismiss dismisses the reminder. If you are using recurring tasks, you want to mark complete - if you dismiss the reminder, it won;t fire on the next occurrence. Diane Poremsky [M365 Apps & Services MVP] https://www.slipstick.com. https://www.outlook-tips.net.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With