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

Application.CalendarDateShadingEditEx 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. CalendarDateShadingEditEx( ** Item, ** Pattern, ** Color** )

expression An expression that returns 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 a hexadecimal value for the RGB color, where red is the last byte. For example, the value &;HFF0000 is blue and &;H00FFFF is yellow.

Return Value



Besides Item, CalendarDateShadingEditEx 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.

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


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 light gray.

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

    CalendarDateShadingEditEx Item:=pjBaseWorking, Pattern:=pjLightFillPattern, Color:=&;H900090 
    CalendarDateShadingEditEx Item:=pjBaseNonworking, Color:=&;HDDDDDD 
End Sub

Note If you use any of the PjColor enumeration constants for the Color parameter, the color will be nearly black. For example, the value of pjGreen is 9, which in the CalendarDateBoxesEx method is a very dark red. To use only the sixteen colors available with PjColor constants, use the CalendarDateShadingEdit method.

© 2018 Microsoft