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で使用できます); そして
- ボタンの作成方法。