【发布时间】:2015-09-28 14:19:33
【问题描述】:
如何使用 VBA 在 Outlook 2013 中复制定期约会?我尝试将 RecurrencePattern 对象从源项目复制到目标项目 (cAppt),但这会将开始日期设置为下一个即时日历间隔(例如,如果现在是 4:12,则重复系列设置为开始于今天 4:30)而不是原始项目的实际开始日期。有关如何执行此操作的任何提示?
Private Sub curCal_ItemAdd(ByVal Item As Object)
Dim cAppt As AppointmentItem
Dim oPatt As RecurrencePattern
Dim cPatt As RecurrencePattern
Dim moveCal As AppointmentItem
' On Error Resume Next
'only copy items not marked as private
If Item.Sensitivity <> olPrivate Then
Item.Body = Item.Body & "[" & GetGUID & "]"
Item.Save
Set cAppt = Application.CreateItem(olAppointmentItem)
If Item.IsRecurring Then
Set cPatt = cAppt.GetRecurrencePattern
cPatt = Item.GetRecurrencePattern
End If
With cAppt
.Subject = Item.Subject
.Start = Item.Start
.Duration = Item.Duration
.Location = Item.Location
.Body = Item.Body
End With
' set the category after it's moved to force EAS to sync changes
Set moveCal = cAppt.Move(newCalFolder)
moveCal.Categories = "moved"
moveCal.Save
End If
End Sub
【问题讨论】:
-
它不会为我复制重复模式。而不是 cPatt = Item.GetRecurrencePattern 我希望之前有一个 Set 。我找不到 SetRecurrencePattern 的方法