Reminders![]() |
Microsoft Outlook 应用程序中所有 Reminder 对象的集合,代表所有将要发生的约会项目的提醒。
使用 Application 对象的 Reminders 属性返回 Reminders 集合。使用 Reminders(index) 返回单个 Reminder 对象,其中 index 为提醒的名称或序数。以下示例显示列表中每个提醒的标题。
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
当新建带提醒的 Microsoft Outlook 项目时,提醒就会由程序创建。例如,如果创建了 AppointmentItem 对象,并且 AppointmentItem 对象的 ReminderSet 属性设置为 True,则会创建提醒。使用 AppointmentItem 对象的 ReminderTime 属性设置提醒出现的时间(以分钟计)。以下示例创建新的会议,并将 ReminderSet 属性设置为 True,同时将新的 Reminder 对象添加到 Reminders 集合。
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