Class Reminder (Outlook VBA)
The class Reminder represents an Outlook reminder. To use a Reminder class variable it first needs to be instantiated, for example
Dim rmn as Reminder
Set rmn = Reminders(Index:=1)
For Each
Here is an example of processing the Reminder items in a collection.
Dim rmn As Reminder
For Each rmn In Reminders
Next rmn
Caption
Returns a String representing the title.
Dim strCaption As String
strCaption = Reminders(1).Caption
Class
Returns an OlObjectClass constant indicating the object's class. Here you can find possible values for
Dim oocsClass As OlObjectClass
oocsClass = Reminders(1).Class
Dismiss
Dismisses the current reminder.
The Dismiss method will fail if there is no visible reminder.
Sub DismissReminders()
'Dismisses any active reminders.
Dim objRems As Outlook.Reminders
Dim objRem As Outlook.Reminder
Dim i As Integer
Set objRems = Application.Reminders
For i = objRems.Count To 1 Step -1
If objRems(i).IsVisible = True Then
objRems(i).Dismiss
End If
Next
Set olApp = Nothing
Set objRems = Nothing
Set objRem = Nothing
End Sub
IsVisible
Returns a Boolean that determines if the reminder is currently visible.
Outlook determines the return value of this property based on the state of the current reminder. All active reminders are visible. If IsVisible is True, the reminder is visible.
Sub DismissReminders()
'Dismisses any active reminders.
Dim objRems As Outlook.Reminders
Dim objRem As Outlook.Reminder
Dim i As Integer
Set objRems = Application.Reminders
For i = objRems.Count To 1 Step -1
If objRems(i).IsVisible = True Then
objRems(i).Dismiss
End If
Next
Set olApp = Nothing
Set objRems = Nothing
Set objRem = Nothing
End Sub
Item
Returns an Object corresponding to the specified Outlook item.
NextReminderDate
Returns a Date that indicates the next time the specified reminder will occur.
The NextReminderDate property value changes every time the object's Snooze method is executed or when the user clicks the Snooze button.
Sub DisplayNextDateReport()
'Displays the next time all reminders will be displayed.
Dim objRems As Outlook.Reminders
Dim objRem As Outlook.Reminder
Dim strTitle As String
Dim strReport As String
Set objRems = Application.Reminders
strTitle = "Current Reminder Schedule:"
strReport = ""
'Check if any reminders exist.
If objRems.Count = 0 Then
MsgBox "There are no current reminders."
Else
For Each objRem In objRems
'Add information to string.
strReport = strReport & objRem.Caption & vbTab & _
objRem.NextReminderDate & vbCr
Next objRem
'Display report in dialog box
MsgBox strTitle & vbCr & vbCr & strReport
End If
End Sub
OriginalReminderDate
Returns a Date that specifies the original date and time that the specified reminder is set to occur.
This value corresponds to the original date and time value before the Snooze method is executed or the user clicks the Snooze button.
Sub DisplayOriginalDateReport()
'Displays the time at which all reminders will be displayed.
Dim objRems As Outlook.Reminders
Dim objRem As Outlook.Reminder
Dim strTitle As String
Dim strReport As String
Set objRems = Application.Reminders
strTitle = "Original Reminder Schedule:"
strReport = ""
'Check if any reminders exist.
If objRems.Count = 0 Then
MsgBox "There are no current reminders."
Else
For Each objRem In objRems
'Add info to string
strReport = strReport & objRem.Caption & vbTab & vbTab & _
objRem.OriginalReminderDate & vbCr
Next objRem
'Display report in dialog
MsgBox strTitle & vbCr & vbCr & strReport
End If
End Sub
Session
Returns the NameSpace object for the current session.
The Session property and the GetNamespace method can be used interchangeably to obtain the NameSpace object for the current session. Both members serve the same purpose. For example, the following statements do the same function:
Snooze
Delays the reminder by a specified time.
This is equivalent to the user clicking the Snooze button. This method will fail if the current reminder is not active.
Snooze (SnoozeTime)
SnoozeTime: Indicates the amount of time (in minutes) to delay the reminder. The default value is 5 minutes.
Sub SnoozeReminders()
'Delays all reminders by a specified amount of time
Dim objRems As Outlook.Reminders
Dim objRem As Outlook.Reminder
Dim varTime As Variant
Set objRems = Application.Reminders
varTime = InputBox("Type the number of minutes to delay")
For Each objRem In objRems
If objRem.IsVisible = True Then
objRem.Snooze (varTime)
End If
Next objRem
End Sub