0

I am trying to forward my working meetings to my personal e-mail address. However, I cannot just forward all the meetings (rule forbidden by my IT department) and I would like to have only limited/essential information in the forwarded mail (subject, time, location...no attachment, no attendees...).

To do so, I defined a rule in Outlook to execute the following VBA script at the reception of appointments. The principle is:

  1. To create a new appointment form scratch
  2. To copy essential information from the original appointment
  3. To send the appointment as a iCalendar item attached to a mail

Here follows what I wrote...but something is wrong since I get not forward on my personal e-mail address...and I do not know either how to debug ! I am very unfamiliar with VBA...

Thanks in advance for your help !

Sub Meeting2NewMail(Item As Outlook.MeetingItem)

Dim OM As AppointmentItem
Dim CM As AppointmentItem
Dim NewMail As MailItem

Set OM = Item.GetAssociatedAppointment(True).Copy
Set CM = Application.CreateItem(olAppointmentItem)

CM.EndInEndTimeZone = OM.EndInEndTimeZone
CM.Location = OM.Location
CM.StartInStartTimeZone = OM.StartInStartTimeZone
CM.Subject = OM.Subject
CM.EndTimeZone = OM.EndTimeZone
CM.StartTimeZone = OM.StartTimeZone
CM.Body = "Work Meeting"

Set NewMail = Application.CreateItem(olMailItem)
NewMail.Subject = CM.Subject
NewMail.Attachments.Add CM
NewMail.Recipients.Add "my.personal.address@test.com"
NewMail.Body = "Work Meeting"
NewMail.Send


OM.Delete
CM.Delete
NewMail.Delete

End Sub
Songio
  • 305
  • 1
  • 13
  • https://stackoverflow.com/questions/50189158/debugging-vba-locating-problems-troubleshooting-methods – niton Oct 30 '21 at 21:28

0 Answers0