下面的VBA代码:
Sub test()
Dim myItem As Object
Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient
Set myItem = Application.CreateItem(olAppointmentItem)
myItem.MeetingStatus = olMeeting
myItem.Subject = "TestSubject"
myItem.Location = "Place"
myItem.Body = "Hi xxx" & vbCrLf & _
"Kind reminder your seat has been confirmed. Please refer below for details." & vbCrLf & vbCrLf & _
"Date&Time" & vbCrLf & _
"Venue" & vbCrLf & vbCrLf & vbCrLf & _
"Please let me know if you cannot make it. Thank you." & vbCrLf & vbCrLf & vbCrLf & _
"With warm regards," & vbCrLf & _
"Name" & _
"Pan Asian Equity Sales" & vbCrLf & _
'Set myRequiredAttendee = myItem.Recipients.Add("Nate Sun")
'myRequiredAttendee.Type = olRequired
myItem.Display
End Sub
现在,内容将仅在Outlook Meeting中提供纯文本。 如何在会议电子邮件正文中更新电子邮件内容格式,例如文本颜色,粗体,下划线等?
预期输出如下:
答案 0 :(得分:0)
尝试这样的事情:
.Body = "{\rtf1\ansi\deff0{\fonttbl{\f0 Arial;}}{\colortbl;\red0\green0\blue255;}\pard\cf1\f0\fs24 Test}"
在xtremevbtalk上找到
修改
这是我用来测试字符串的完整子代码:
Sub testoApptItem()
Dim oAppointmentItem As Outlook.AppointmentItem
Set oAppointmentItem = Application.CreateItem(olAppointmentItem)
With oAppointmentItem
.Body = "{\rtf1\ansi\deff0{\fonttbl{\f0 Arial;}}{\colortbl;\red0\green0\blue255;}\pard\cf1\f0\fs24 Test}"
.Subject = "test"
.Start = Now
.End = Now + 0.25
.Location = ""
.ReminderSet = False
.Categories = "AM/PM Assigned"
.Save
End With
End Sub
答案 1 :(得分:0)
您需要设置ApppoontmentItem.RftBody
属性-它需要一个可变的字节数组(不仅仅是字符串)。
Outlook 2016也可以理解约会中的HTML,但是OOM仍然不会在HTMLBody
对象上公开ApppoontmentItem
属性。您可以尝试使用ApppoontmentItem.PropertyAccessor.SetProperty设置PR_HTML
MAPI属性(DASL名称为http://schemas.microsoft.com/mapi/proptag/0x10130102
)。