Colored "View | Gantt Chart"

S

SoftwareTester

One of the old positings by Jan de Messemaeker contained a useful macro
making it possible to color tasks in a "View | Gantt Chart" red based on some
criteria.
i xtended it coloring tasks green if they have been completed but
unfortunally after performing a recovery from backup I can't find that
updated macro anymore nor the posting by Jan.

So : how can I color tasks in "View \ Gantt Chart" from VBA?

It would also be nice if this macro would execute automatically each time I
open the Gant Chart.
 
J

Jan De Messemaeker

Hi,

You only need VBA for rather complex conditions.
To color completed tasks green (and making that happen automatically) the
following combination of actions will do:

Format, Bar Styles, add a line as follows
Name: Comp Tsks (or whatever you like)
Appearance: green
Show For... select Finished
OK.


More generally, since I don't exactly remember the macro you mention either,
to color a group of tasks via VBA this is a possibility:

First, create a bar style (see above) with in Show For... Flag1

Then the macro would be

sub ColorFlag1
dim Job as task
for each Job in activeproject.tasks
if not job is nothing then
if (condition)
job.flag1=true
else
job.flag1=false
end if 'condition
end if 'nothing
next job
end sub

The following would also work

sub ColorFlag1
dim Job as task
for each Job in activeproject.tasks
if not job is nothing then
job.flag1=(condition)
end if 'nothing
next job
end sub

To make it happen automatically when activationg the Gantt Chart is more
complicated.
I generally create a button on a toolbar that runs the macro

Hope this helps,
--
Jan De Messemaeker
Microsoft Project Most Valuable Professional
+32 495 300 620
For availability check:
http://users.online.be/prom-ade/Calendar.pdf
 

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