Application.GanttBarStyleEdit method (Project)
Changes or creates a Gantt bar style.
Syntax
expression. GanttBarStyleEdit
( _Item_
, _Create_
, _Name_
, _StartShape_
, _StartType_
, _StartColor_
, _MiddleShape_
, _MiddleColor_
, _MiddlePattern_
, _EndShape_
, _EndType_
, _EndColor_
, _ShowFor_
, _Row_
, _From_
, _To_
, _BottomText_
, _TopText_
, _LeftText_
, _RightText_
, _InsideText_
)
expression A variable that represents an Application object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Item | Required | String | The name or row number of the Gantt bar style to change in the Bar Styles dialog box. |
Create | Optional | Boolean | True if a new Gantt bar style is created and inserted in the Bar Styles dialog box before the Gantt bar style specified with Item. If Item is "-1", the new Gantt bar style is added to the end of the list of styles. The default value is False. |
Name | Optional | String | A new name for the Gantt bar. |
StartShape | Optional | Integer | The start shape of the Gantt bar. The default value is pjNone. Can be one of the PjBarEndShape constants. |
StartType | Optional | Integer | The start type of the Gantt bar. Can be one of the following PjBarType constants: pjDashed, pjFramed, or pjSolid. The default value is pjSolid. |
StartColor | Optional | Integer | The start color of the Gantt bar. The default value is pjBlack. Can be one of the PjColor constants. |
MiddleShape | Optional | Integer | The middle shape of the Gantt bar. Can be one of the PjBarShape constants. The default value is pjRectangleBar. |
MiddleColor | Optional | Integer | The middle color of the Gantt bar. Can be one of the PjColor constants. The default value is pjBlack. |
MiddlePattern | Optional | Integer | The middle pattern of the Gantt bar. Can be one of the PjFillPattern constants. The default value is pjMediumFillPattern. |
EndShape | Optional | Integer | The end shape of the Gantt bar. Can be one of the PjBarEndShape constants. The default value is pjNone. |
EndType | Optional | Integer | The end type of the Gantt bar. Can be one of the following PjBarType constants: pjDashed, pjFramed, or pjSolid. The default value is pjSolid. |
EndColor | Optional | Integer | The end color of the Gantt bar. Can be one of the PjColor constants. The default value is pjBlack. |
ShowFor | Optional | String | One or more task types (such as normal, split, summary, milestone, and so on) separated by the list separator character. |
Row | Optional | Integer | A number from 1 to 4 that specifies the row in which the Gantt bar appears. The default value is 1. |
From | Optional | String | The name of a date field specifying the start of the Gantt bar. |
To | Optional | String | The name of a date field specifying the end of the Gantt bar. |
BottomText | Optional | String | The task field to display below the Gantt bar. |
TopText | Optional | String | The task field to display above the Gantt bar. |
LeftText | Optional | String | The task field to display to the left of the Gantt bar. |
RightText | Optional | String | The task field to display to the right of the Gantt bar. |
InsideText | Optional | String | The task field to display inside the Gantt bar. |
Return value
Boolean
Remarks
To manually show the Bar Styles dialog box, click the Format tab under the Gantt Chart Tools tab. In the Bar Styles group, click Bar Styles in the Format drop-down list. The Bar Styles dialog box can contain up to 200 style entries.
To edit Gantt bar styles where colors can be hexadecimal RGB values, use the GanttBarEditEx method.
Example
The following example creates a bar style that has a light green color and ends with a star shape.
Sub CreateGanttBar()
GanttBarStyleEdit Item:=-1, Create:=True, Name:="My New Bar Style", MiddleColor:=pjLime, EndShape:=pjStar
End Sub
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.