Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2015, 08:31 AM
bootneck bootneck is offline How to color task according to % complete Windows 8 How to color task according to % complete Office 2013
Novice
How to color task according to % complete
 
Join Date: Nov 2015
Posts: 2
bootneck is on a distinguished road
Question How to color task according to % complete

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
Reply With Quote
  #2  
Old 11-29-2015, 10:36 AM
JulieS JulieS is offline How to color task according to % complete Windows 7 64bit How to color task according to % complete Office 2013
Expert
 
Join Date: Dec 2011
Location: New England
Posts: 1,693
JulieS will become famous soon enough
Default

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
Reply With Quote
  #3  
Old 11-29-2015, 11:30 AM
bootneck bootneck is offline How to color task according to % complete Windows 8 How to color task according to % complete Office 2013
Novice
How to color task according to % complete
 
Join Date: Nov 2015
Posts: 2
bootneck is on a distinguished road
Default

Many thanks Julie, I will try these solutions and post how I got on.
Reply With Quote
  #4  
Old 11-29-2015, 11:57 AM
JulieS JulieS is offline How to color task according to % complete Windows 7 64bit How to color task according to % complete Office 2013
Expert
 
Join Date: Dec 2011
Location: New England
Posts: 1,693
JulieS will become famous soon enough
Default

I'm not a coder, but I'll try to help.
Reply With Quote
Reply

Tags
colors, fields, task

Thread Tools
Display Modes


Similar Threads
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
How to color task according to % complete Task Indicator - All predecessors complete true/false, y/n jdove78 Project 2 10-10-2012 05:53 PM
How to color task according to % complete excel cannot complete this task with available resources - vlookup 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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:37 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft