B
bgnjoe
(Posted previously to microsoft.public.project.vba group. Thanks for
pointing me in the right direction Mike.)
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? BTW. Using MS Project Pro 2003 and Enterprise
Server 2003.
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
pointing me in the right direction Mike.)
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? BTW. Using MS Project Pro 2003 and Enterprise
Server 2003.
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