Conditonally formatting tasks

F

FUDGONAUT

I'm a novice Project 2000 user, trying to format the font color of
rows. So for example, in the Gantt view I have a column called
Department. If the value in Department is "QA", I want the font in
that row to be a certain color (effectiviely color-coding tasks by
department so people can see which tasks are theirs).

I did some digging online, and found some Visual Basic script stuff to
do this, but I have no experience with VB and I kept getting errors.
Is there any easier way to go about this? Any help is greatly
appreciated!
 
J

Jim Reid

Fudgeonaut,

I had a similar issue where I wanted the whole line in RED if there was
Actual Work reported. I had to do it through VBA. Maybe this code snippet
will help.

Private Sub Project_Open(ByVal pj As Project)
Dim i As Integer
For i = 1 To (ActiveProject.Tasks.Count)
If ActiveProject.Tasks(i).ActualWork > 0 Then
SelectRow row:=ActiveProject.Tasks(i).ID, RowRelative:=False
Font Color:=pjRed
End If
Next i
End Sub

Jim
 
F

FUDGONAUT

Thanks Jim. I tried the scripts listed here:

http://techrepublic.com.com/5100-10878_11-1028245.html#

But when I tried to compile them, I would get error messages. For
example, the line:

For Each tskT In ActiveProject.Tasks

Returned the message "Compile Error: Invalid Outside Procedure." As I
said, I have zero experience with VB, I have no idea if it's a problem
with the script, or if I'm unaware of crucial steps in VB.
 
F

FUDGONAUT

Basically, I don't understand the syntax of VB. My department column
is Outline1, though I guess I can switch that to Text1 if that makes
things any easier. I know that I want to do this much:

Case "Accounting"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjMaroon
Case "Customer Service"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjNavy
Case "Manufacturing"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjPurple
Case "Shipping"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjOlive
Case "Recievng"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjTeal

The problem is I don't understand how to use the beginning stuff (e.g.
"For Each tskT In ActiveProject.Tasks") to make the script run without
returning errors.

Thanks again for the feedback.
 
J

John

FUDGONAUT said:
Basically, I don't understand the syntax of VB. My department column
is Outline1, though I guess I can switch that to Text1 if that makes
things any easier. I know that I want to do this much:

Case "Accounting"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjMaroon
Case "Customer Service"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjNavy
Case "Manufacturing"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjPurple
Case "Shipping"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjOlive
Case "Recievng"
SelectRow Row:=tskT.ID, RowRelative:=False
Font Color:=pjTeal

The problem is I don't understand how to use the beginning stuff (e.g.
"For Each tskT In ActiveProject.Tasks") to make the script run without
returning errors.

Thanks again for the feedback.

FUDGONAUT,
Although VBA can certainly do what you want, it is also fairly easy to
accomplish this without VBA. Create an interactive filter or series of
filters that isolate the "department" field. Then select all the rows
the filter singles out and go to Format/Font to set the font color.

Hope this helps.
John
Project MVP
 

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