Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Color coding tasks in a Microsoft Project Macro

This seems like it should be straight forward, but I'm seeing some strange behavior. I'm attempting to color code my tasks based on a flag. It appears to be correctly coloring the tasks, but at some point in the processing the initial tasks that were colored are getting reset to black. The task that it happens on seems to be fairly inconsistent too. Here's how I'm trying to perform this task (simplified to it's barest form):

Sub ColorTasks()
    Dim t As Task
    For Each t In ActiveProject.Tasks
        SelectRow t.ID, RowRelative:=False
        Font32Ex Color:=2366701
    Next
End Sub

This code seems to work just fine for smaller data sets, but this project contains around 2,000 tasks. Any ideas?

like image 260
Shawn Avatar asked Feb 27 '26 12:02

Shawn


1 Answers

I know that this is an old question but I hope it may be useful for someone with similar problem.

The mistake is that you've forgotten to add 'H' before hexadecimal number, so properly there should be:

Font32Ex CellColor:=&H3A3AD4
etc
like image 65
Tomek Avatar answered Mar 02 '26 14:03

Tomek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!