Macro not setting font color

G

Grant Lawes

Hello,

The purpose of the following code is to find tasks that should be
complete, but are not, and to set their font color to red. The code
works perfectly except that some of the tasks do not end up with a red
color. When I use the debugger it finds the tasks correctly, selects
them all, but for some reason skips or misses some when setting the font
color to red. It is just the last line that is not doing what it is
supposed to.

FilterApply Name:="@ UR", value1:=entry, value2:=entry
If ActiveSelection > 0 Then
SelectTaskField Row:=0, Column:="Text18"
SetTaskField field:="text18", Value:="Red"
SelectColumn (4)
FillDown (True)
SelectSheet // Also tried SelectAll method which did not
work
Font Color:=pjRed
End If

Thanks

Grant
 
J

JackD

Grant,

I suggest that you use an alternate method.
There is already a filter which shows tasks which are behind schedule.
So go to the project menu / filter for / more filters / find the filter for
"slipping tasks" / make a copy / set it to be a highlight filter

Then go to the format menu / text styles / find the highlight style/ set it
to red

Now run the filter and the tasks will turn red.

If you want to set the bar color, use a flag field
Choose an unused one (in this example use Flag1)
then right click on the column header, choose customize fields
click on the formula button
create a formula which returns a true value if the conditions are met (you
can use the same sorts of conditions as in the filter),
Then go to format menu / bar styles and create a bar style the way you like
which has the "show for..." condition set to Flag1.
 

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