View.GoToDate 方法 (Outlook)
更改当前视图用来显示信息的日期。
语法
expression。 GoToDate
( _Date_
)
表达 一个代表 View 对象的变量。
参数
名称 | 必需/可选 | 数据类型 | 说明 |
---|---|---|---|
Date | 必需 | Date | 应当将视图更改到的日期。 |
备注
若要指定当前视图要前往的日期,如 CalendarView 对象,应先使用 Explorer.CurrentView 而不是 Folder.CurrentView 为当前视图获得一个 View 对象。 下面的代码示例演示如何执行此操作。
Sub TestGoToDate()
Dim oCV As Outlook.CalendarView
Dim oExpl As Outlook.Explorer
Dim datGoTo As Date
datGoTo = "11/7/2005"
' Display the contents of the Calendar default folder.
Set oExpl = Application.Explorers.Add( _
Application.Session.GetDefaultFolder(olFolderCalendar), olFolderDisplayFolderOnly)
oExpl.Display
' Retrieve the current view by calling the
' CurrentView property of the Explorer object.
Set oCV = oExpl.CurrentView
' Set the CalendarViewMode property of the
' current view to display items by day.
oCV.CalendarViewMode = olCalendarViewDay
' Call the GoToDate method to set the date
' for which information is displayed in the view.
oCV.GoToDate datGoTo
End Sub
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。