Email triggered by Reminder

J

john

I'm getting an error on this Code Line of the 1st case:
objMsg.To = Item.To

I want to be able to email all those Scehduled for a meeting off the
reminder notice. It works if I give it an Email string, it just will not
return the original To. If it does not store them, is there a work around to
get them.


Private Sub Application_Reminder(ByVal Item As Object)
Dim objMsg As MailItem
' create new outgoing message
Set objMsg = Application.CreateItem(olMailItem)

' your reminder notification address
objMsg.Subject = "Reminder: " & Item.Subject
' must handle all 4 types of items that can generate reminders
Select Case Item.Class
Case olAppointment '26

objMsg.To = Item.To

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
' send the message
objMsg.Send
Set objMsg = Nothing
End Sub
 
G

Guest

You can't use Item.To because the passed item object could be an Appointment,
Task, Contact or Mail Item - whatever the reminder was set on. Only MailItem
supports a To property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top