Я могу успешно использовать приведенный ниже код, чтобы добавить электронное письмо к встрече, прежде чем сохранять ее в своем календаре. Однако, когда я пытаюсь заполнить электронное письмо до того, как оно попадет на встречу, оно будет пустым, как только встреча будет сохранена в Outlook.
Есть ли способ сохранить электронное письмо во время встречи со всей соответствующей информацией, которую я передаю ему в With olMail
? Если да, то как мне этого добиться?
Private Sub calendarUpdate()
'puts an appointment and agenda into my outlook calendar
Dim olApp As Outlook.Application
Dim olApt As AppointmentItem
Dim olMail As MailItem
Set olApp = New Outlook.Application
Set olApt = olApp.CreateItem(olAppointmentItem)
Set olMail = olApp.CreateItem(olMailItem)
emailText = "<H3>Hi Engineer,<br></H3>" & _
"Can you please fill in the agenda template below (marked red) and send it back to me ASAP, I will reformat the email where necessary before sending it to the broker/client<br><br>." & _
"Cheers"
With olMail
.To = ActiveCell.Offset(0, 21)
.Subject = ActiveCell.Offset(0, 2) & " " & ActiveCell.Offset(0, 3) & " Agenda Letter Review."
.HTMLBody = emailText
End With
With olApt
.AllDayEvent = True
.Start = Label3.Caption
.End = Label3.Caption
.Subject = ActiveCell.Offset(0, 18)
.Location = ActiveCell.Offset(0, 4) & ", " & ActiveCell.Offset(0, 5) & ", " & ActiveCell.Offset(0, 6) & ", " & ActiveCell.Offset(0, 7) & " " & ActiveCell.Offset(0, 8)
.Attachment.Add olMail
.Categories = "EA to Schedule"
.ReminderSet = True
.Save
End With
End Sub