I'm trying to create outlook meeting invite using VBA. Meeting invite is getting created. Subject and other fields are also getting updated correctly. But i'm getting empty body whenever i use .HTMLBody.
Tried copying other simple codes but none of them working. Not sure if i'm missing something here.
Below is the code that i tried:
Set OutApp = Outlook.Application
Set OutMeet = OutApp.CreateItem(olAppointmentItem)
With OutMeet
.Subject = Subj
.RequiredAttendees = ActiveSheet.Range("G9").Value
ThisWorkbook.Sheets("Sheet1").Select
.Start = ThisWorkbook.Worksheets("Sheet1").Range("D2").Value
.Duration = 10
.Importance = olImportanceHigh
.ReminderMinutesBeforeStart = 15
ThisWorkbook.Sheets("Sheet2").Select
.BodyFormat = olFormatHTML
.HTMLBody = "<html><head></head><body>Hi</body></html>"
Application.Visible = True
MeetingStatus = olMeeting
.Location = "Microsoft Teams"
.Display
End With
Set OutMeet = Nothing
Set OutApp = Nothing
End Sub
CodePudding user response:
There is no HTMLBody
for appointment items.
CodePudding user response:
Make sure you have your outlook reference libraries turned on and then try
.Body = "Hi"
This worked for me