我正在尝试将数据从Excel复制到Outlook约会项目。我已经创建了一个带有表和一些图像的模板,并且希望从模板正文中已经格式化的表中的excel文件中复制数据。但是,与电子邮件不同,Outlook约会不支持".htmlbody"
属性,因此很难将数据粘贴到模板中。
到目前为止,我正在尝试这样做:
Dim olAppItem as Outlook.AppointmentItem
Set olAppItem = olApp.CreateItemFromTemplate("C:\Users\User1\Desktop\Invite.oft")
以下两行是我遇到问题的地方。
olAppItem.BodyFormat = olFormatRichtext
olAppItem.RTFBody = Replace(olAppItem.RTFBody, "%1%", "Test", , , vbDatabaseCompare)
我已尝试将olAppItem.Bodyformat
设置为olformatHTML
,但它不支持该属性。
感谢任何帮助。
感谢。
答案 0 :(得分:0)
请试一试。
Private Sub Add_Appointments_To_Outlook_Calendar()
'Include Microsoft Outlook nn.nn Object Library from Tools -> References
Dim oAppt As AppointmentItem
Dim Remind_Time As Double
i = 2
Subj = ThisWorkbook.Sheets(1).Cells(i, 1)
'Loop through entire list of Reminders to be added
While Subj <> ""
Set oAppt = Outlook.Application.CreateItem(olAppointmentItem)
oAppt.Subject = Subj
oAppt.Location = ThisWorkbook.Sheets(1).Cells(i, 2)
oAppt.Start = ThisWorkbook.Sheets(1).Cells(i, 3)
Remind_Time = ThisWorkbook.Sheets(1).Cells(i, 4) * 1 * 60
oAppt.ReminderMinutesBeforeStart = Remind_Time
oAppt.AllDayEvent = True
oAppt.Save
i = i + 1
Subj = ThisWorkbook.Sheets(1).Cells(i, 1)
Wend
MsgBox "Reminder(s) Added To Outlook Calendar"
End Sub
' The code comes from this link:
http://officetricks.com/add-appointment-to-outlook-calendar-through-excel-macro-vba/
我写了一本关于这些事情的书,以及许多其他相似但不同的东西。请从下面的链接中查看。