GanttBarFormat

M

mikeMC

I would like to test on the name of a roll Milestote.
Therefore can I read the TaskID or the TopText:

Help function states that GanttBarFormat is a Boolean
function. Is there a way to read each part of the
GanttBarFormat?

example

GanttBarFormat TaskID:=taskNumber, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, TopText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"

Thanks
 
J

Jack D.

mikeMC said:
I would like to test on the name of a roll Milestote.
Therefore can I read the TaskID or the TopText:

Help function states that GanttBarFormat is a Boolean
function. Is there a way to read each part of the
GanttBarFormat?

example

GanttBarFormat TaskID:=taskNumber, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, TopText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"

Thanks


No, you can't get that stuff. There is no need since you can get the task
name directly.
To test to see if a task is a milestone and output the name of that
milestone simply do the following.

Sub checkIfMilestone()
Dim t As Task
For Each t In ActiveProject.Tasks
If t.Milestone Then
msgbox t.name
End If
Next t
End Sub


--
Please try to keep replies in this group. I do check e-mail, but only
infrequently. For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP
email: J -at- eM Vee Pee S dot COM


+++++++++++++++++++
 
B

BF

No, you can't get that stuff. There is no need since you can get the task
name directly.
To test to see if a task is a milestone and output the name of that
milestone simply do the following.

Sub checkIfMilestone()
Dim t As Task
For Each t In ActiveProject.Tasks
If t.Milestone Then
msgbox t.name
End If
Next t
End Sub

Does that mean there is also no way to retrieve the color of a gantt bar? I
can see how to set the color using GanttBarFormat, but I can't find a way to
retrieve the original color...
 
M

MikeMC

What I was trying to do was to put names of the rollup
Milestone on the row up gantbar. I was able to do this
after 4 days of playing around. This is the short code to
do the task. Thanks for the insite.


Public Sub testRowup()
Dim tasknumber As Long

tasknumber = ActiveCell.task.ID
GanttBarSub tasknumber
End Sub

Public Sub GanttBarSub(task As Long)
'Setup the GanttBar
GanttBarFormat TaskID:=task, GanttStyle:=5,
StartShape:=2, StartType:=0, StartColor:=0,
MiddleShape:=2, MiddlePattern:=1, MiddleColor:=0,
EndShape:=2, EndType:=0, EndColor:=0, RightText:="Resource
Names", ProjectName:="C:\Documents and Settings\Michael
McVeigh\My Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 1, GanttStyle:=6,
StartShape:=0, StartType:=0, StartColor:=0,
MiddleShape:=1, MiddlePattern:=3, MiddleColor:=5,
EndShape:=0, EndType:=0, EndColor:=0,
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 2, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, TopText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 3, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, BottomText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 4, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, TopText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 5, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, BottomText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
End Sub
 
J

Jack D.

BF said:
Does that mean there is also no way to retrieve the color of a gantt bar?
I can see how to set the color using GanttBarFormat, but I can't find a
way to retrieve the original color...

That is correct. You can set the color but you can't retrieve it.
You should never depend on how something is formatted to retrieve
information.
Saying "I want to see all "green" tasks" is useless if someone has hit the
gantt chart wizard button and reformatted things.

It is much better to have the format based on some attribute/property of the
task. Store the information in one of the custom fields and then set the
formatting based on the value of that field.

I can not think of any case where it would be necessary to know what the
color of the bar is. If you can provide me with one, I can tell you how to
do it without using the bar color.


--
Please try to keep replies in this group. I do check e-mail, but only
infrequently. For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP
email: J -at- eM Vee Pee S dot COM


+++++++++++++++++++
 
J

Jack D.

Mike,
I think you can make this a lot shorter and more manageable.
Take a look at some of the macro examples on my site
http://masamiki.com/project/macros.htm
particularly the one called "All Green" for how you might make it a bit
simpler.
For example, you do not need to supply the name of the project everytime,
indeed it will work better if you don't hardcode the name.

-Jack
What I was trying to do was to put names of the rollup
Milestone on the row up gantbar. I was able to do this
after 4 days of playing around. This is the short code to
do the task. Thanks for the insite.


Public Sub testRowup()
Dim tasknumber As Long

tasknumber = ActiveCell.task.ID
GanttBarSub tasknumber
End Sub

Public Sub GanttBarSub(task As Long)
'Setup the GanttBar
GanttBarFormat TaskID:=task, GanttStyle:=5,
StartShape:=2, StartType:=0, StartColor:=0,
MiddleShape:=2, MiddlePattern:=1, MiddleColor:=0,
EndShape:=2, EndType:=0, EndColor:=0, RightText:="Resource
Names", ProjectName:="C:\Documents and Settings\Michael
McVeigh\My Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 1, GanttStyle:=6,
StartShape:=0, StartType:=0, StartColor:=0,
MiddleShape:=1, MiddlePattern:=3, MiddleColor:=5,
EndShape:=0, EndType:=0, EndColor:=0,
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 2, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, TopText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 3, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, BottomText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 4, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, TopText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
GanttBarFormat TaskID:=task + 5, GanttStyle:=8,
StartShape:=3, StartType:=1, StartColor:=0,
MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0,
EndShape:=0, EndType:=0, EndColor:=0, BottomText:="Name",
ProjectName:="C:\Documents and Settings\Michael McVeigh\My
Documents\Work\TSD\tsd reports\TSD SAP 2.mpp"
End Sub



--
Please try to keep replies in this group. I do check e-mail, but only
infrequently. For Macros and other things check http://masamiki.com/project

-Jack Dahlgren, Project MVP
email: J -at- eM Vee Pee S dot COM


+++++++++++++++++++
 

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