Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / September 2006

Tip: Looking for answers? Try searching our database.

Email triggered by Reminder

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
john - 21 Sep 2006 22:10 GMT
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
Eric Legault [MVP - Outlook] - 25 Sep 2006 19:01 GMT
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.

Signature

Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/

> I'm getting an error on this Code Line of the 1st case:
> objMsg.To = Item.To
[quoted text clipped - 41 lines]
>   Set objMsg = Nothing
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.