Avatar of DavidRGarner
 asked on

Outlook Visual Basic - Reminder Event

Using information available via a Google search I have put together an Outlook macro to send an email to a list of recipients when a Calendar reminder fires.  The code below works perfectly as long as I don't try to include any attachments that may be present in the Appointment body/details section.  I want the reminder email that this macro generates to also include attachments if they are present in the appointment item.  Can anyone tell me what code I need to add to make this happen?  I have worked/experimented on this issue for many days with no success.  I have finally decided to ask the experts.  (Note that the source object is an AppointmentItem).   Thanks!

Private Sub Application_Reminder(ByVal EventItem As Object)
Dim MailMsg As MailItem
Set MailMsg = Application.CreateItem(olMailItem)
If EventItem.MessageClass = "IPM.Appointment" Then
  Call SendApptMail(MailMsg, EventItem)
End If
Set MailMsg = Nothing
End Sub
Sub SendApptMail(Mail_Item As Object, Appt_Item As Object)
Mail_Item.To = Appt_Item.Location
Mail_Item.Subject = Appt_Item.Subject
Mail_Item.Attachments = Appt_Item.Attachments   'this line throws an error - Help!
Mail_Item.HTMLBody = Appt_Item.Body  'other html formatting omitted for brevity
End Sub

Open in new window

OutlookMicrosoft OfficeMicrosoft Applications

Avatar of undefined
Last Comment

8/22/2022 - Mon

Have you tried to add each attachment individually rather than as a collection?? something like:
for each oAttachment in Appt_Items.Attachments
     Mail_Item.Attachments.add oAttachment

Open in new window

Hope this helps


Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Your help has saved me hundreds of hours of internet surfing.