N
NordicWally12
This seems like it should be a very simple first project, but I can't get it
right.
I want to create a macro that will run through all tasks in a project,
changing all a task's_text_ color on a row (not Gantt chart) to pjGreen if
the that task has % Completion == 100. During my Monday team meetings, I can
focus on what the team is saying, then color-code the lines afterwards with a
global post-processing macro.
The code I have currently _will_ run through the tasks and - based on the
Debug.Print - is indeed finding the 100% lines. But it isn't changing the
text color.
Here's what I've got so far:
Sub DCT_greenDone()
' Macro NW12_greenDone
' Macro Recorded Fri 3/9/07.
'This macro sets a task record's text to green if 100% Complete
Dim trow As Task
For Each trow In ActiveProject.Tasks
If Not trow Is Nothing Then
If trow.PercentComplete > 99 Then
Debug.Print trow.ID, trow.Name, trow.PercentComplete
SelectRow Row:=trow.ID, RowRelative:=False
TextStyles Item:=4, Color:=pjGreen ' Doesn't seem to change
anything
' Font Color:=pjGreen ' Nope, changes all records
Else
End If
End If
Next trow
End Sub
Both "Font" and "TextStyles" work if I do a macro record on a single line.
Any suggestions, or am I trying to carry water in a sieve here ?
right.
I want to create a macro that will run through all tasks in a project,
changing all a task's_text_ color on a row (not Gantt chart) to pjGreen if
the that task has % Completion == 100. During my Monday team meetings, I can
focus on what the team is saying, then color-code the lines afterwards with a
global post-processing macro.
The code I have currently _will_ run through the tasks and - based on the
Debug.Print - is indeed finding the 100% lines. But it isn't changing the
text color.
Here's what I've got so far:
Sub DCT_greenDone()
' Macro NW12_greenDone
' Macro Recorded Fri 3/9/07.
'This macro sets a task record's text to green if 100% Complete
Dim trow As Task
For Each trow In ActiveProject.Tasks
If Not trow Is Nothing Then
If trow.PercentComplete > 99 Then
Debug.Print trow.ID, trow.Name, trow.PercentComplete
SelectRow Row:=trow.ID, RowRelative:=False
TextStyles Item:=4, Color:=pjGreen ' Doesn't seem to change
anything
' Font Color:=pjGreen ' Nope, changes all records
Else
End If
End If
Next trow
End Sub
Both "Font" and "TextStyles" work if I do a macro record on a single line.
Any suggestions, or am I trying to carry water in a sieve here ?