Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automate email for outlook Appointment reminders 1

Status
Not open for further replies.

gamesman

Programmer
Oct 8, 2001
223
US
I want to write a process that will automatically send an email everytime that a calendar reminder kicks off. I know that I probably want to use an "Application_Reminder(ByVal Item As Object)" sub, but I'm not sure what else.

Basically, when the reminder kicks off in Outlook, I also want en email sent to the listed contacts.

Thanks for any suggestions.

Jeff Hughes
MT(ASCP), MCP, CIW, CNA
 
I can't take the credit for this one but it should look something like this :-

Code:
Private Sub Application_Reminder(ByVal Item As Object)
   If Item.Sensitivity <> olConfidential Then
      If TypeOf Item Is AppointmentItem Then SendMailReminder Item
   End If
End Sub

Private Sub SendMailReminder(ByRef Item As AppointmentItem)
   Dim oEmail As Object
   Set oEmail = Application.CreateItem(olMailItem)
   oEmail.Subject = Item.Subject
   oEmail.Body = FormatDateTime(Item.Start, vbShortTime) & _
                "-" & FormatDateTime(Item.End, vbShortTime) & vbCrLf & _
                Item.Location
   oEmail.Recipients.Add "joe.bloggs@aol.com"
   oEmail.Send
End Sub

To insert the code open Outlook and select "Tools/Macro/Visual Basic Editor". Double click "Project1", then click "Microsoft Outlook Object", then click "ThisOutlookSession". Copy the code in there. Now select "File/Save/VbaProject.OTM".

Restart Outlook and make sure "Enable Macros" is selected.

The code as you probably already know will only work if Outlook is open when the calendar reminder is activated.

Enjoy.
 
Hey thanks, it works. Because of the security features of 2003 I did have to change "oEmail.Recipients.Add" to "oEmail.To =". Now if I can just figure out how to prevent the dang popup about sending mail on behalf of me, I'll be golden.

Jeff Hughes
MT(ASCP), MCP, CIW, CNA
 
Do a google search for outlook object model guard

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks guys.

Jeff Hughes
MT(ASCP), MCP, CIW, CNA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top