共用方式為


Outlook) (View.GoToDate 方法

會變更目前檢視使用的日期以顯示資訊。

語法

expressionGoToDate( _Date_ )

表達 代表 View 物件的變數。

參數

名稱 必要/選用 資料類型 描述
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

另請參閱

View 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應