B
bstandkeiii
I have the following code which changes color of gantt bars based on some
criteria. How do I change the font color of the associated task name. I
have tried a number of things without success.
Sub setganttcolor()
'This macro shows how to set a barstyle depending on a certain
'value in the text5 field. Right now the case statement is
'commented out, so it will make all of your tasks green
'If you comment out the green line, this macro is useful
'to clear any custom formatting that you may have applied to
'specific tasks.
'Copyright Jack Dahlgren, Feb. 2002
On Error GoTo setganttcolorend
Dim ts As Tasks
Set ts = ActiveProject.Tasks
Dim t As Task
Dim i As Integer
For Each t In ActiveProject.Tasks
i = i + 1
Select Case t.Text1
Case "p"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjPurple,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjPurple, EndColor:=pjPurple
Case "g"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjGreen,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjGreen, EndColor:=pjGreen
Case "r"
SelectTaskColumn ("name")
Font Bold:=True, Color:=pjRed
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjRed,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjMaroon, EndColor:=pjMaroon
Case "y"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjLime,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjLime, EndColor:=pjLime
Case "b"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjBlue,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjLime, EndColor:=pjLime
Case Else
End Select
Next t
setganttcolorend:
End Sub
Thanks in avance
criteria. How do I change the font color of the associated task name. I
have tried a number of things without success.
Sub setganttcolor()
'This macro shows how to set a barstyle depending on a certain
'value in the text5 field. Right now the case statement is
'commented out, so it will make all of your tasks green
'If you comment out the green line, this macro is useful
'to clear any custom formatting that you may have applied to
'specific tasks.
'Copyright Jack Dahlgren, Feb. 2002
On Error GoTo setganttcolorend
Dim ts As Tasks
Set ts = ActiveProject.Tasks
Dim t As Task
Dim i As Integer
For Each t In ActiveProject.Tasks
i = i + 1
Select Case t.Text1
Case "p"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjPurple,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjPurple, EndColor:=pjPurple
Case "g"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjGreen,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjGreen, EndColor:=pjGreen
Case "r"
SelectTaskColumn ("name")
Font Bold:=True, Color:=pjRed
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjRed,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjMaroon, EndColor:=pjMaroon
Case "y"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjLime,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjLime, EndColor:=pjLime
Case "b"
GanttBarFormat TaskID:=t.ID, Reset:=True
GanttBarFormat TaskID:=t.ID, MiddleColor:=pjBlue,
MiddlePattern:=pjSolidFillPattern, StartColor:=pjLime, EndColor:=pjLime
Case Else
End Select
Next t
setganttcolorend:
End Sub
Thanks in avance