Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private WithEvents olRemind As Outlook.Reminders
- Dim strSubject As String
- Private Sub Application_Reminder(ByVal Item As Object)
- Set olRemind = Outlook.Reminders
- strSubject = Item.subject
- Dim objMsg As MailItem
- Set objMsg = Application.CreateItem(olMailItem)
- objMsg.To = "INSERT EMAIL HERE"
- objMsg.subject = strSubject
- ' Code to handle the 4 types of items that can generate reminders
- Select Case Item.Class
- Case olAppointment '26
- objMsg.Body = _
- "Start: " & Item.Start & vbCrLf & _
- "End: " & Item.End & vbCrLf & _
- "Location: " & Item.Location & vbCrLf & _
- "Details: " & vbCrLf & Item.Body
- Case olContact '40
- objMsg.Body = _
- "Contact: " & Item.FullName & vbCrLf & _
- "Phone: " & Item.BusinessTelephoneNumber & vbCrLf & _
- "Contact Details: " & vbCrLf & Item.Body
- Case olMail '43
- objMsg.Body = _
- "Due: " & Item.FlagDueBy & vbCrLf & _
- "Details: " & vbCrLf & Item.Body
- Case olTask '48
- objMsg.Body = _
- "Start: " & Item.StartDate & vbCrLf & _
- "End: " & Item.DueDate & vbCrLf & _
- "Details: " & vbCrLf & Item.Body
- End Select
- objMsg.Send
- Set objMsg = Nothing
- End Sub
- Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)
- For Each objRem In olRemind
- If objRem.Caption = strSubject Then
- If objRem.IsVisible Then
- objRem.Dismiss
- Cancel = True
- End If
- Exit For
- End If
- Next objRem
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment