Format task bar color

D

Dewey

Hi
I'm relatively new to Project, and am trying to instantiate it from an
Outlook COM add-in. I've hit a little stumbling block. I need the code, in
VB.NET, that will allow me to change a task bar's color and symbol. I know
this sounds simple...I'm hoping it is. I just don't have the familiarity
with the Project object model.

Thanks for any help
-Josh
 
J

Jan De Messemaeker

Hi,

From the VBA help:

GanttBarFormat Method


Formats Gantt bars.

Syntax

expression.GanttBarFormat(TaskID, GanttStyle, StartShape, StartType,
StartColor, MiddleShape, MiddlePattern, MiddleColor, EndShape, EndType,
EndColor, LeftText, RightText, TopText, BottomText, InsideText, Reset,
ProjectName)

expression Optional. An expression that returns an Application object.

TaskID Optional Long. The identification number of the task represented by
the Gantt bar to be changed. The default is to change the Gantt bars of the
selected tasks.

GanttStyle Optional Integer. The style applied to the Gantt bar to be
formatted. The value for GanttStyle is based on the position of the bar
style in the list. For example, the value 3 returns the third bar style in
the list.

StartShape Optional Long. The start shape of the Gantt bar. Can be one of
the following PjBarEndShape constants:

Constant Description

pjNoBarEndShape None
pjHouseUp House
pjHouseDown Upside-down house
pjDiamond Diamond
pjCircleDiamond Circled diamond
pjTriangleUp Triangle pointing up
pjTriangleDown Triangle pointing down
pjTriangleRight Triangle pointing right
pjTriangleLeft Triangle pointing left
pjCircleTriangleUp Circled triangle pointing up
pjCircleTriangleDown Circled triangle pointing down
pjArrowUp Arrow pointing up
pjArrowDown Arrow pointing down
pjCircleArrowUp Circled arrow pointing up
pjCircleArrowDown Circled arrow pointing down
pjCaretDownTop Caret pointing down on the top half of the bar
pjCaretUpBottom Caret pointing up on the bottom half of the bar
pjLineShape Line
pjSquare Square
pjCircle Circle
pjStar Star


StartType Optional Long. The start type of the Gantt bar. Can be one of
the following PjBarType constants: pjDashed, pjFramed, or pjSolid.

StartColor Optional Long. The start color of the Gantt bar. Can be one of
the following PjColor constants:

pjColorAutomatic pjNavy
pjAqua pjOlive
pjBlack pjPurple
pjBlue pjRed
pjFuschia pjSilver
pjGray pjTeal
pjGreen pjYellow
pjLime pjWhite
pjMaroon


MiddleShape Optional Long. The middle shape of the Gantt bar. Can be one
of the following PjBarShape constants: pjNone, pjRectangleBar,
pjRectangleTop, pjRectangleMiddle, pjRectangleBottom, pjLineTop,
pjLineMiddle, or pjLineBottom.

MiddlePattern Optional Long. The middle pattern of the Gantt bar. Can be
one of the following PjFillPattern constants:

pjDarkFillPattern pjLineCrossPattern
pjDiagonalCrossPattern pjLineHorizontalPattern
pjDiagonalLeftPattern pjLineVerticalPattern
pjDiagonalRightPattern pjMediumFillPattern
pjHollowPattern pjSolidFillPattern
pjLightFillPattern


MiddleColor Optional Long. The middle color of the Gantt bar. Can be one
of the PjColor constants.

EndShape Optional Long. The end shape of the Gantt bar. Can be one of the
PjBarEndShape constants.

EndType Optional Long. The end type of the Gantt bar. Can be one of the
following PjBarType constants: pjDashed, pjFramed, or pjSolid.

EndColor Optional Long. The end color of the Gantt bar. Can be one of the
PjColor constants.

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.

TopText Optional String. The task field to display above the Gantt bar.

BottomText Optional String. The task field to display below the Gantt bar.

InsideText Optional String. The task field to display inside the Gantt
bar.

Reset Optional Boolean. True if the bar formatting is reset to the default
formatting of the style in the Bar Styles dialog box.

ProjectName Optional String. The name of the project containing TaskID if
consolidation is involved. The default value is the name of the active
project.

Remarks

Using the GanttBarFormat method without specifying any arguments displays
the Bar Styles dialog box.

Use the GanttBarFormat method to change the formatting of Gantt bars from
their default styles. To define the default styles, use the
GanttBarStyleEdit method.


Hope this helps,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top