Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub AutoReplywithTemplate(Item As Outlook.MailItem)
- Dim oRespond As Outlook.MailItem
- ' Use this for a real reply
- ' Set oRespond = Item.Reply
- ' This sends a response back using a template
- Set oRespond = Application.CreateItemFromTemplate("C:\path\to\template.oft")
- With oRespond
- .Recipients.Add Item.SenderEmailAddress
- .Subject = "Your Subject Goes Here"
- .HTMLBody = "Your reply text goes here." & vbCrLf & _
- "---- original body below ---" & vbCrLf & _
- Item.HTMLBody & vbCrLf & _
- "---- Template body below ---" & _
- vbCrLf & oRespond.HTMLBody
- ' includes the original message as an attachment
- .Attachments.Add Item
- ' use this for testing, change to .send once you have it working as desired
- .Display
- End With
- Set oRespond = Nothing
- End Sub
- Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
- Dim rrEID As Variant, varEID As Variant, olkItm As Object, olkAppointment As Outlook.AppointmentItem
- arrEID = Split(EntryIDCollection, ",")
- arrWords = Split(KILL_WORDS, ",")
- For Each varEID In arrEID
- Set olkItm = Session.GetItemFromID(varEID)
- If olkItm.Class = olMeetingRequest Then
- Set olkAppointment = olkItm.GetAssociatedAppointment(False)
- If DatePortion(olkAppointment.Start) = DatePortion(olkAppointment.End) Then
- If TimePortion(olkAppointment.Start) <= #2:15:00 PM# And TimePortion(olkAppointment.End) >= #3:00:00 PM# Then
- olkAppointment.Respond olMeetingDeclined
- End If
- End If
- End If
- Next
- End Sub
- Function DatePortion(datValue As Date) As Date
- DatePortion = Format(datValue, "dd/mm/yyyy")
- End Function
- Function TimePortion(datValue As Date) As Date
- TimePortion = Format(datValue, "hh:mm:ss")
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement