Reminders Collection

Microsoft Outlook Visual Basic

Reminders Collection

Reminders Reminder

A collection of all the Reminder objects in a Microsoft Outlook application that represents the reminders for all pending items.

Using the Reminders collection

Use the Application object's Reminders property to return the Reminders collection. Use Reminders(index), where index is the name or ordinal value of the reminder, to return a single Reminder object. The following example displays the captions of each reminder in the list.

Sub ViewReminderInfo()
'Lists reminder caption information

    Dim olApp As Outlook.Application
    Dim objRem As Reminder
    Dim objRems As Reminders
    Dim strTitle As String
    Dim strReport As String

    Set olApp = Outlook.Application
    Set objRems = olApp.Reminders
    strTitle = "Current Reminders:"
    'If there are reminders, display message
    If olApp.Reminders.Count <> 0 Then
        For Each objRem In objRems
            'If string is empty, create new string
            If strReport = "" Then
                strReport = objRem.Caption & vbCr
            Else
                'Add info to string
                strReport = strReport & objRem.Caption & vbCr
            End If
        Next objRem
        'Display report in dialog
        MsgBox strTitle & vbCr & vbCr & strReport
    Else
        MsgBox "There are no reminders in the collection."

    End If

End Sub
		

Reminders are created programmatically when a new Microsoft Outlook item is created with a reminder. For example, a reminder is created when an AppointmentItem object is created and the AppointmentItem object's ReminderSet property is set to True. Use the AppointmentItem object's ReminderTime property to set the time in minutes at which the reminder will occur. The following example creates a new appointment item and sets the ReminderSet property to True, adding a new Reminder object to the Reminders collection.

Sub AddAppt()
'Adds a new appointment and reminder to the reminders collection

    Dim olApp As Outlook.Application
    Dim objApt As AppointmentItem

    Set olApp = Outlook.Application
    Set objApt = olApp.CreateItem(olAppointmentItem)

    objApt.ReminderSet = True
    objApt.Subject = "Tuesday's meeting"
    objApt.Save

End Sub