Guest User

Splicing of Slapstick Scripts - Reminder Email and Dismiss

a guest
Aug 26th, 2016
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private WithEvents olRemind As Outlook.Reminders
  2. Dim strSubject As String
  3.  
  4. Private Sub Application_Reminder(ByVal Item As Object)
  5.  
  6.   Set olRemind = Outlook.Reminders
  7.  
  8.   strSubject = Item.subject
  9.     Dim objMsg As MailItem
  10.   Set objMsg = Application.CreateItem(olMailItem)
  11.  
  12.   objMsg.To = "INSERT EMAIL HERE"
  13.   objMsg.subject = strSubject
  14.  
  15.   ' Code to handle the 4 types of items that can generate reminders
  16.  Select Case Item.Class
  17.      Case olAppointment '26
  18.        objMsg.Body = _
  19.           "Start: " & Item.Start & vbCrLf & _
  20.           "End: " & Item.End & vbCrLf & _
  21.           "Location: " & Item.Location & vbCrLf & _
  22.           "Details: " & vbCrLf & Item.Body
  23.      Case olContact '40
  24.        objMsg.Body = _
  25.           "Contact: " & Item.FullName & vbCrLf & _
  26.           "Phone: " & Item.BusinessTelephoneNumber & vbCrLf & _
  27.           "Contact Details: " & vbCrLf & Item.Body
  28.       Case olMail '43
  29.        objMsg.Body = _
  30.           "Due: " & Item.FlagDueBy & vbCrLf & _
  31.           "Details: " & vbCrLf & Item.Body
  32.       Case olTask '48
  33.        objMsg.Body = _
  34.           "Start: " & Item.StartDate & vbCrLf & _
  35.           "End: " & Item.DueDate & vbCrLf & _
  36.           "Details: " & vbCrLf & Item.Body
  37.   End Select
  38.  
  39.  
  40.   objMsg.Send
  41.   Set objMsg = Nothing
  42. End Sub
  43.  
  44. Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)
  45.  
  46.     For Each objRem In olRemind
  47.             If objRem.Caption = strSubject Then
  48.                 If objRem.IsVisible Then
  49.                     objRem.Dismiss
  50.                     Cancel = True
  51.                 End If
  52.                 Exit For
  53.             End If
  54.         Next objRem
  55.  
  56. End Sub
Advertisement
Add Comment
Please, Sign In to add comment