Reminders Collection

Microsoft Outlook Visual Basic

Reminders Collection

         
Reminders Multiple objects

A collection of all the Reminder objects in a Microsoft Outlook application that represents the reminders for all pending appointment 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 meeting and sets the ReminderSet property to True, adding a new Reminder object to the Reminders collection.

Sub AddMeeting()
'Adds a new meeting and reminder to the reminders collection

    Dim olApp As Outlook.Application
    Dim objMeet As AppointmentItem

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

    objMeet.ReminderSet = True
    objMeet.Subject = "Tuesday's meeting"

End Sub