![]() |
#1
|
|||
|
|||
![]()
I have used Project for Windows since its first release back in 1990 but I have never had reason to program any extensions to it - until now. I need to set the color of a task according to various parameters, one of which is % Complete (entered manually, not calculated from other data).
I am aware of using the Marked field to color a task but this is insufficient as it's a simple binary switch. I am running into two issues: 1. I am not sure that I am coding correctly - here is what I have tried though the Debugger doesn't like the field name: Sub ColorFormatOL() Dim t As Task Dim i As Integer i = 1 For Each t In ActiveProject.Tasks SelectRow row:=i, rowrelative:=False Select Case t.PercentWorkComplete Case Is = 0 Font32Ex CellColor:=&HB37F15 Case Is > 0 Font32Ex CellColor:=&HD6982E Case Is = 100 Font32Ex CellColor:=&HF6BE41 End Select i = i + 1 Next t End Sub 2. I have looked all over the web for a formal list of actual object field names within Project but can find only explanations of the fields rather than the actual characters I need to type to invoke those fields Any help would be much appreciated. Thank you...... Bootneck |
#2
|
|||
|
|||
![]()
Your code ran fine for me but it is changing the background color - not the text color. I'd change the order of the second and third case statements as 100% is greater than zero. The case statement stops at the first true, so it never reaches the 100.
A quick search also turned up: https://msdn.microsoft.com/en-us/lib.../ff862901.aspx The FontEx method allows you to use the PJ colors https://msdn.microsoft.com/en-us/lib.../ff862872.aspx |
#3
|
|||
|
|||
![]()
Many thanks Julie, I will try these solutions and post how I got on.
|
#4
|
|||
|
|||
![]()
I'm not a coder, but I'll try to help.
|
![]() |
Tags |
colors, fields, task |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Physical % Complete and Task Duration | ChuckM | Project | 3 | 02-09-2014 09:21 AM |
Change Cell Color Based On % Complete | jrfoley3 | Project | 1 | 05-30-2013 05:24 AM |
![]() |
jdove78 | Project | 2 | 10-10-2012 05:53 PM |
![]() |
Taisho | Excel | 4 | 01-27-2012 03:09 AM |
Stop the % Complete of subatasks from counting against the Main task | bzeyger | Project | 0 | 06-08-2010 06:19 AM |