Application.CalendarDateShadingEditEx method (Project)
Changes the background color and pattern of date boxes in the Calendar view.
Syntax
expression. CalendarDateShadingEditEx
( _Item_
, _Pattern_
, _Color_
)
expression An expression that returns an Application object.
Parameters
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 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
Boolean
Remarks
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)
Example
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 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.
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.