Export (0) Print
Expand All
Expand Minimize

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.

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 one of the PjColor constants.

Return Value

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 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
Show:
© 2015 Microsoft