Displaying holidays in the Gantt chart

C

Candido Rodriguez

MSP takes care of the holidays of a resource when drawing
the bar in the GANT chart.
Is it possible to see the bar in a way holidays are
displayed differently than working days ?
Thanks for you answer.

C@ndido
 
J

Jan De Messemaeker

Hi Candido,

Nice to hear from you again - starting to be a user hey
I have an article on this on my website
HTH
 
C

candido Rodriguez

Yes indeed I try go deeper in the product and I suppose
the problem I am facing with is not new.
I found a VB script that works fine. It creates a new
project and present the holidays per ressource as tasks.
this is enough for me at the moment but I would like to
see it in the same Gantt chart
Thanks anyway, I will go and visit your site.
For those who are interessed I post here beneath the code
I found (the code has been written by Michael Magan,
thanks to him).
Sub HolidayGantt()
' Creates a new project, with a task for each resource
' The task bar shows the holidays for each resource
' The range for the calendar is from project start to 3
months beyond
' the project finish
' For the visual effect, we put a block at the start and
the end of the
' bar
' 14-Jun-2001 Michael Magan

Dim PrjSrc As Project ' Source project
Dim PrjDest As Project ' New (destination) project
Dim T As Task
Dim D As Date
Dim DCalStart As Date
Dim DCalEnd As Date

Set PrjSrc = ActiveProject

FileNew
Set PrjDest = ActiveProject
PrjDest.ProjectStart = PrjSrc.ProjectStart

' Set the date range for the holiday calendar
DCalStart = PrjSrc.ProjectStart
DCalEnd = PrjSrc.ProjectFinish + 90

For Each R In PrjSrc.Resources
Set T = PrjDest.Tasks.Add(Name:=R.Name)

' Set a dummy holiday at the start and end of the
calendar
' This creates a dotted line for the duration of this
task
T.TimeScaleData(DCalStart _
, DCalStart + 1 _
, pjTaskTimescaledWork _
, pjTimescaleDays)(1).Value = 8 * 60
T.TimeScaleData(DCalEnd _
, DCalEnd + 1 _
, pjTaskTimescaledWork _
, pjTimescaleDays)(1).Value = 8 * 60

' For each day of the project, compare the resource
calendar
' with the standard calendar. If the standard
calendar has
' a working day, and the resource calendar does not,
then it
' is a holiday
For D = DCalStart To DCalEnd
If PrjSrc.BaseCalendars(1).Period(D, D).Working And
Not _
R.Calendar.Period(D, D).Working Then
T.TimeScaleData(D _
, D + 1 _
, pjTaskTimescaledWork _
, pjTimescaleDays)(1).Value = 8 * 60
End If
Next D
Next R
End Sub

C@ndido
 
J

Jan De Messemaeker

Hi,
There is a macro on my website as well; it groups consecutive holidays into
one task.
HTH
 

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