CalendarView.DayWeekTimeScale Property (Outlook)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns or sets an OlDayWeekTimeScale constant that represents the scale used to represent time periods in a CalendarView object. Read/write.

expression .DayWeekTimeScale

expression A variable that represents a CalendarView object.

The following Visual Basic for Applications (VBA) example creates a new CalendarView object in the Calendar default folder, and then configures it to display 14 consecutive days in multi-day mode, with Outlook items displayed within an hourly time scale.

Sub CreateTwoWeekView() 
 
 Dim objNamespace As NameSpace 
 
 Dim objFolder As Folder 
 
 Dim objView As CalendarView 
 
 
 
 ' Obtain Folder object reference to the Calendar default folder. 
 
 Set objNamespace = Application.GetNamespace("MAPI") 
 
 Set objFolder = objNamespace.GetDefaultFolder(olFolderCalendar) 
 
 
 
 ' Create a new CalendarView object named "Two Weeks". 
 
 Set objView = objFolder.Views.Add("Two Weeks", _ 
 
 olCalendarView, _ 
 
 olViewSaveOptionAllFoldersOfType) 
 
 
 
 ' Configure the new CalendarView object. 
 
 With objView 
 
 ' Display the view in multi-day mode. 
 
 .CalendarViewMode = olCalendarViewMultiDay 
 
 
 
 ' Display 14 consecutive days in multi-day 
 
 ' mode. 
 
 .DaysInMultiDayMode = 14 
 
 ' Set the time scale for the view in one-hour 
 
 ' intervals. 
 
 .DayWeekTimeScale = olTimeScale60Minutes 
 
 
 
 ' Save and apply the new CalendarView object. 
 
 .Save 
 
 .Apply 
 
 End With 
 
End Sub 
 

Show: