Sub SnoozedReminders()
' http://www.jpsoftwaretech.com/check-your-outlook-reminders-in-vba/
Dim MyReminder As Outlook.Reminder
Dim MyReminders As Outlook.Reminders
Dim Report As String
Dim i As Long
Set MyReminders = Outlook.Reminders
i = 0
For Each MyReminder In MyReminders
If HasReminderFired(MyReminder) = True Then
i = i + 1
Report = Report & i & ": " & MyReminder.Caption & vbCr & _
" Snoozed to " & MyReminder.NextReminderDate & vbCr & vbCr
End If
Next MyReminder
CreateReportAsEmail "Snoozed Items", Report
End Sub
Function HasReminderFired(rmndr As Outlook.Reminder) As Boolean
HasReminderFired = (rmndr.OriginalReminderDate <> rmndr.NextReminderDate)
End Function
' VBA SubRoutine which displays a report inside an email
' Programming by Greg Thatcher, http://www.GregThatcher.com
Public Sub CreateReportAsEmail(Title As String, Report As String)
On Error GoTo On_Error
Dim Session As Outlook.Namespace
Dim mail As MailItem
Dim MyAddress As AddressEntry
Dim Inbox As Outlook.folder
Set Session = Application.Session
Set Inbox = Session.GetDefaultFolder(olFolderInbox)
Set mail = Inbox.items.Add("IPM.Mail")
mail.Subject = Title
mail.Body = Report
mail.Save
mail.Display
Exiting:
Set Session = Nothing
Set Inbox = Nothing
Set mail = Nothing
Exit Sub
On_Error:
MsgBox "error=" & Err.Number & " " & Err.Description
Resume Exiting
End Sub
如果您不熟悉VBA,请参见Slipstick的说明页。您将找到有关以下信息:
- 宏安全设置;
- 将代码放置在哪里(可以将常规模块与Insert | Module一起使用);和
- 如何创建一个按钮。