Application.CalendarDateShadingEdit method (Project)
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.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Item | Required | Long | The type of calendar day to change. Can be one of the PjCalendarShading constants. |
Pattern | Optional | Long | The pattern for the type of date box specified by Item. Can be one of the PjFillPattern constants. |
Color | Optional | Long | The color for the type of date box specified by Item. Can be one of the PjColor constants. |
Boolean
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 calendar 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
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.