Outlook) (AppointmentItem.End 属性
返回或设置结束日期和时间的 AppointmentItem日期 。 读/写。
语法
表达式。结束
表达 一个代表 AppointmentItem 对象的变量。
示例
此 Visual Basic for Applications (VBA) 示例使用 CreateItem 创建一个 AppointmentItem 对象。 RecurrencePattern 是为此物料使用 AppointmentItem.GetRecurrencePattern 方法得到的。 通过设置 RecurrencePattern 属性、 介于 1 、 PatternStartDate 和 PatternEndDate ,约会现在是每天都发生的一年期定期系列。
使用 GetOccurrence 方法来获取此定期约会的一个实例和该实例的属性会被更改时,创建的 异常 对象。 使用 GetRecurrencePattern 方法来访问这一系列与关联的 异常 集合中获得约会系列到此异常。 消息框显示原始的 AppointmentItem.Subject 和 Exception.OriginalDate 系列的约会和当前日期、 时间和主题对此异常此异常。
Public Sub cmdExample()
Dim myApptItem As Outlook.AppointmentItem
Dim myRecurrPatt As Outlook.RecurrencePattern
Dim myNamespace As Outlook.NameSpace
Dim myFolder As Outlook.Folder
Dim myItems As Outlook.Items
Dim myDate As Date
Dim myOddApptItem As Outlook.AppointmentItem
Dim saveSubject As String
Dim newDate As Date
Dim myException As Outlook.Exception
Set myApptItem = Application.CreateItem(olAppointmentItem)
myApptItem.Start = #2/2/2003 3:00:00 PM#
myApptItem.End = #2/2/2003 4:00:00 PM#
myApptItem.Subject = "Meet with Boss"
'Get the recurrence pattern for this appointment
'and set it so that this is a daily appointment
'that begins on 2/2/03 and ends on 2/2/04
'and save it.
Set myRecurrPatt = myApptItem.GetRecurrencePattern
myRecurrPatt.RecurrenceType = olRecursDaily
myRecurrPatt.PatternStartDate = #2/2/2003#
myRecurrPatt.PatternEndDate = #2/2/2004#
myApptItem.Save
'Access the items in the Calendar folder to locate
'the master AppointmentItem for the new series.
Set myNamespace = Application.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderCalendar)
Set myItems = myFolder.Items
Set myApptItem = myItems("Meet with Boss")
'Get the recurrence pattern for this appointment
'and obtain the occurrence for 3/12/03.
myDate = #3/12/2003 3:00:00 PM#
Set myRecurrPatt = myApptItem.GetRecurrencePattern
Set myOddApptItem = myRecurrPatt.GetOccurrence(myDate)
'Save the existing subject. Change the subject and
'starting time for this particular appointment
'and save it.
saveSubject = myOddApptItem.Subject
myOddApptItem.Subject = "Meet NEW Boss"
newDate = #3/12/2003 3:30:00 PM#
myOddApptItem.Start = newDate
myOddApptItem.Save
'Get the recurrence pattern for the master
'AppointmentItem. Access the collection of
'exceptions to the regular appointments.
Set myRecurrPatt = myApptItem.GetRecurrencePattern
Set myException = myRecurrPatt.Exceptions.item(1)
'Display the original date, time, and subject
'for this exception.
MsgBox myException.OriginalDate & ": " & saveSubject
'Display the current date, time, and subject
'for this exception.
MsgBox myException.AppointmentItem.Start & ": " & _
myException.AppointmentItem.Subject
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。