B
bgnjoe
As will be obvious in my post, I'm not an expert in VBA, but would like
to learn how to create macros - starting with ones that seem easy and
have a practical use for me. For my first macro, I thought I'd try
changing the color of a row based on a flag and created the following:
Sub ChangeColor()
Dim t As Task
For Each t In ActiveProject.Tasks
If t.EnterpriseFlag1 Then
SelectRow Row:=t, RowRelative:=False
Font Color:=pjRed
End If
Next t
End Sub
The practice schedule I'm using has 14 tasks. The 13th task has the
EnterpriseFlag1 set to "Yes". When I run this, it changes the color of
the row for Task 5 to Red. Obviously, the "t" Task variable is not
behaving as I thought it would because t=5 when the actual row = 13.
What am I doing wrong?
As a side question, I downloaded the Proj98VBE training that I found
recommended in another post here (or maybe the server group). It's
fairly helpful, but I was wondering if anyone could recommend a book
that would help a beginner?
Thanks.
Joe
to learn how to create macros - starting with ones that seem easy and
have a practical use for me. For my first macro, I thought I'd try
changing the color of a row based on a flag and created the following:
Sub ChangeColor()
Dim t As Task
For Each t In ActiveProject.Tasks
If t.EnterpriseFlag1 Then
SelectRow Row:=t, RowRelative:=False
Font Color:=pjRed
End If
Next t
End Sub
The practice schedule I'm using has 14 tasks. The 13th task has the
EnterpriseFlag1 set to "Yes". When I run this, it changes the color of
the row for Task 5 to Red. Obviously, the "t" Task variable is not
behaving as I thought it would because t=5 when the actual row = 13.
What am I doing wrong?
As a side question, I downloaded the Proj98VBE training that I found
recommended in another post here (or maybe the server group). It's
fairly helpful, but I was wondering if anyone could recommend a book
that would help a beginner?
Thanks.
Joe