I am trying to add a formatted value, from Excel to an appointment in Outlook, based on: HTMLBody Workaround For OlAppointment Object?
I get the following error:
"Run-time error '287': Application-defined or object-defined error"
I also need to create a hyperlink in an appointment, using link in one cell and text I want to be visible in another.
Sub MakeApptWithRangeBody()
Dim olApp As Outlook.Application
Dim olApt As Outlook.AppointmentItem
Const wdPASTERTF As Long = 1
Set olApp = Outlook.Application
Set olApt = olApp.CreateItem(olAppointmentItem)
With olApt
.Start = Now + 1
.End = Now + 1.2
.Subject = "Test Appointment"
.Location = 18
'Sheet1.ListObjects(1).Range.Copy
ThisWorkbook.Worksheets("Sheet1").Range("D2").Copy
.Display
.GetInspector.WordEditor.Windows(1).Selection.PasteAndFormat wdPASTERTF
End With
End Sub