Hi,
I have a need to send an automatic email to the person that set up the meeting in Outlook when the meeting ends. It would be great if it also sent a copy to an administrator email as well. This is on a shared calendar only, so not sure how the outlook session needs to be set up?
So far I have the following...
Private Sub Application_Reminder(ByVal Item As Object)
Dim NewMail As MailItem
Dim objAtts As Recipients
Dim obj As Object
Dim strAddrs As String
If TypeOf Item Is AppointmentItem And Item.Recipients.Count Then
Set objAtts = Item.Recipients
'Extract the attendees who have accepted this meeting
For Each obj In objAtts
If obj.MeetingResponseStatus = olResponseAccepted Then
strAddrs = strAddrs & obj.Address
End If
Next
Set NewMail = Outlook.Application.CreateItem(olMailItem)
With NewMail
.To = strAddrs
.Subject = "Return notification - please arrange the return of loan item(s)"
.HTMLBody = "<HTML><BODY> When: " & Item.Start & " - " & Item.End & "</HTML></BODY>" & "<HTML><BODY>Where: " & Item.Location & "</HTML></BODY>" & "<HTML><BODY>Details: " & Item.Body & "</HTML></BODY>"
.Attachments.Add Item
.DeferredDeliveryTime = Item.End
.Display
End With
End If
End Sub
This creates an email, but at the start of the meeting and not the end, it also doesn't send it automatically as I would need to press the send button. I have only tested it on my local calendar and not a shared calendar.
Thanks in advance if you can help...
cheers
Richard
I have a need to send an automatic email to the person that set up the meeting in Outlook when the meeting ends. It would be great if it also sent a copy to an administrator email as well. This is on a shared calendar only, so not sure how the outlook session needs to be set up?
So far I have the following...
Private Sub Application_Reminder(ByVal Item As Object)
Dim NewMail As MailItem
Dim objAtts As Recipients
Dim obj As Object
Dim strAddrs As String
If TypeOf Item Is AppointmentItem And Item.Recipients.Count Then
Set objAtts = Item.Recipients
'Extract the attendees who have accepted this meeting
For Each obj In objAtts
If obj.MeetingResponseStatus = olResponseAccepted Then
strAddrs = strAddrs & obj.Address
End If
Next
Set NewMail = Outlook.Application.CreateItem(olMailItem)
With NewMail
.To = strAddrs
.Subject = "Return notification - please arrange the return of loan item(s)"
.HTMLBody = "<HTML><BODY> When: " & Item.Start & " - " & Item.End & "</HTML></BODY>" & "<HTML><BODY>Where: " & Item.Location & "</HTML></BODY>" & "<HTML><BODY>Details: " & Item.Body & "</HTML></BODY>"
.Attachments.Add Item
.DeferredDeliveryTime = Item.End
.Display
End With
End If
End Sub
This creates an email, but at the start of the meeting and not the end, it also doesn't send it automatically as I would need to press the send button. I have only tested it on my local calendar and not a shared calendar.
Thanks in advance if you can help...
cheers
Richard