CalendarView object (Outlook)
Represents a view that displays Outlook items in a calendar format.
Remarks
The CalendarView object, derived from the View object, allows you to create customizable views that allow you to display Outlook items within a calendar, in one of several different modes.
Outlook provides several built-in CalendarView objects, and you can also create custom CalendarView objects. Use the Add method of the Views collection to add a new CalendarView to a Folder object. Use the Standard property to determine if an existing CalendarView object is built-in or custom.
The CalendarView object supports several different view modes, depending on the desired layout and time period in which to display Outlook items. Use the CalendarViewMode property to set the view mode, the StartField property to specify the Outlook item property that contains the start date, and the EndField property to specify the Outlook item property that contains the end date for Outlook items to be displayed.
If you set the CalendarViewMode property to any value other than olCalendarViewMonth, you can use the DayWeekFont and DayWeekTimeFont properties to configure the fonts used to display the day, date, and time labels in the view. Use the DayWeekTimeScale to configure the time scale used to display Outlook items within the view. If you set the CalendarViewMode to olCalendarViewMultiDay, you can use the DaysInMultiDayMode property to determine the number of days to display in the view.
If you set the CalendarViewMode to olCalendarViewMonth, you can use the MonthFont property to configure the fonts used to display the month and day labels and the MonthShowEndTime to indicate whether the end time for is displayed in the view.
You can also configure how Outlook items appear within the CalendarView object. Use the BoldSubjects property to indicate whether subjects for Outlook items are displayed in bold and the BoldDatesWithItems property to indicate whether dates in the Date Navigator that contain Outlook items are displayed in bold. Use the Filter property to determine which Outlook items to display in the view.
The definition for each CalendarView object is stored in Extensible Markup Language (XML) format. Use the XML property to work with the XML definition for the CalendarView object.
Use the Apply method to apply any changes made to the CalendarView object to the current view. Use the Save method to persist any changes made to the CalendarView object. Use the LockUserChanges property to allow or prevent changes to the user interface for the view.
You can change built-in CalendarView objects, but you cannot delete them. Use the Delete method to delete a custom CalendarView object. Use the Reset method to reset the properties of a built-in CalendarView object to their default values.
Example
The following Visual Basic for Applications (VBA) example configures the current CalendarView object to show a single day, using an 8-point Verdana font to display items and a 16-point Verdana font to display time values and the Tasks header within the view.
Sub ConfigureDayViewFonts()
Dim objView As CalendarView
' Check if the current view is a calendar view.
If Application.ActiveExplorer.CurrentView.ViewType = _
olCalendarView Then
' Obtain a CalendarView object reference for the
' current calendar view.
Set objView = _
Application.ActiveExplorer.CurrentView
With objView
' Set the calendar view to show a
' single day.
.CalendarViewMode = olCalendarViewDay
' Set the DayWeekFont to 8-point Verdana.
.DayWeekFont.Name = "Verdana"
.DayWeekFont.Size = 8
' Set the DayWeekTimeFont to 16-point Verdana.
.DayWeekTimeFont.Name = "Verdana"
.DayWeekTimeFont.Size = 16
' Save the calendar view.
.Save
End With
End If
End Sub
See also
Outlook Object Model Reference CalendarView Object Members
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.