Table of contents
Collapse the table of content
Expand the table of content

Application.CalendarDateShadingEdit Method (Project)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Changes the background color and pattern of date boxes in the Calendar view.


expression. CalendarDateShadingEdit( ** Item, ** Pattern, ** Color** )

expression A variable that represents an Application object.


NameRequired/OptionalData TypeDescription
ItemRequiredLongThe type of calendar day to change. Can be one of the PjCalendarShading constants.
PatternOptionalLongThe pattern for the type of date box specified by Item. Can be one of the PjFillPattern constants.
ColorOptionalLongThe color for the type of date box specified by Item. Can be one of the PjColor constants.

Return Value



Besides Item, CalendarDateShadingEdit requires either the Pattern or Color parameter, or both, to run without an error. For example, the following line in the Immediate pane of the VBE works correctly.

? CalendarDateShadingEdit (PjCalendarShading.pjBaseWorking, , &;H01dddd)

To edit calendar date boxes where the colors can be RGB values, use the CalendarDateShadingEditEx method.


The following example changes the background color of working days in the base calander to a stippled purple and the color of nonworking days to gray.

Sub CalendarDate_ShadingEdit() 
 ' Activate the Caldender view. 
 ViewApply Name:="Calendar" 

 CalendarDateShadingEdit Item:=pjBaseWorking, Pattern:=pjLightFillPattern, Color:=pjPurple 
 CalendarDateShadingEdit Item:=pjBaseNonworking, Color:=pjGray 
End Sub
© 2018 Microsoft