PDA

View Full Version : Sending emails based on calander alerts using VBA



tips
12-03-2015, 04:57 AM
Hi,

First post please forgive me if i do something wrong.

So i am using outlook 2010 on a windows 7 64 bit system. I am using the below code to send automate emails based on calander alerts.

Private Sub Application_Reminder(ByVal Item As Object)
Dim objMsg As MailItem
Set objMsg = Application.CreateItem(olMailItem)

'IPM.TaskItem to watch for Task Reminders
If Item.MessageClass <> "IPM.Appointment" Then
Exit Sub
End If

If Item.Categories <> "Send Message" Then
Exit Sub
End If


objMsg.To = Item.Location
objMsg.Subject = Item.Subject
objMsg.Body = Item.Body
objMsg.Send


Set objMsg = Nothing
End Sub



This works perfectly apart from sending duplicate emails. I can not stop the duplicate email.

Thanks for any help.

regards

Craig

tips
12-03-2015, 06:18 AM
If there is an easier way to send emails based on a calander i love to hear it thanks

tips
12-09-2015, 04:27 AM
At the moment someone sits with a clock and sends the emails manually. we want to free up this person and send them using a schedule. Its for training some students. Any ideas?

skatonni
12-09-2015, 10:52 AM
Nothing in the VBA to send duplicates. Perhaps the reminder is being snoozed rather than being dismissed. Perhaps a copy is being made in ItemSend code.

Try setting a breakpoint and step through the code when the reminder is triggered.

tips
12-10-2015, 05:59 AM
thanks for the reply and advice il take a look

tips
12-10-2015, 07:47 AM
I have tried playing with the actual reminder. No matter if its snoozed, left alone or dismissed always two emails.

How do I check if a copy is being made in ItemSend code?

skatonni
12-10-2015, 11:04 AM
If you had Application_ItemSend code it would be in the ThisOutlookSession module.