Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Feb 2004
    Location
    Houston, Texas, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Milestone Format in Summary Task (2000/SR1)

    I have a master plan in which I've pasted a number of subproject plans (not linked, as they won't be updated). I'm writing a macro that (1) rolls up milestones to the summary bar through project plans and then (2) puts the name of the milestone task below the milestone indicator in the summary task. The first part is working well, however, I can't get (2) to work. Here is my code:

    Sub RollupMilestones()
    Dim T As Task

    ' Display milestones in summary bars
    ' Cycle through tasks in active project.
    For Each T In ActiveProject.Tasks
    ' If task is a milestone or a summary, set its Rollup property to True.
    If T.Summary Or T.Milestone Then
    T.Rollup = True
    ' If task isn't a summary task or milestone, set its Rollup property to False.
    Else
    T.Rollup = False
    End If
    ' Apply Task Name to Bottom of Milestone Indicator

    Next T

    End Sub

    I know the code to change add the Task Name to the milestone in the summary bar, e.g.,
    GanttBarFormat TaskID:=???, BottomText:="Name"
    however I don't know how to select each milestone on the summary bar, get its associated TaskID, and go to the next milestone. I know it will probably be some kind of For Each...Next loop but that's about it.

    Can anyone help?

    Thanks,
    Caroline

  2. #2
    Star Lounger
    Join Date
    Feb 2004
    Location
    Houston, Texas, USA
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Milestone Format in Summary Task (2000/SR1)

    I kept at it and was able to get this to work as I wanted. Here is the code:

    Sub Rollup_Milestones()
    Dim T As task
    Dim var As String

    ' Display milestones in summary bars
    ' Cycle through tasks in active project.
    For Each T In ActiveProject.Tasks
    ' If task is a milestone or a summary, set its Rollup property to True.
    If T.Summary Or T.Milestone Then
    T.Rollup = True
    'Tasknumber = ActiveCell.task.ID
    'If task isn't a summary task or milestone, set its Rollup property to False.
    Else
    T.Rollup = False
    End If
    Next T

    'Format milestones on summary tasks to show Task Name as Bottom Text
    For Each T In ActiveProject.Tasks
    var = T.ID
    If T.Milestone Then
    GanttBarFormat TaskID:=var, GanttStyle:=10, StartShape:=3, StartType:=1, _
    StartColor:=0, MiddleShape:=0, MiddlePattern:=1, MiddleColor:=0, _
    EndShape:=0, EndType:=0, EndColor:=0, BottomText:="Name"
    End If
    Next T

    'Show only top level milestone tasks for each project
    FilterApply Name:="Top Level Tasks"

    End Sub

    Have a great weekend!
    Caroline

  3. #3
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Milestone Format in Summary Task (2000/SR1)

    Caroline,

    Thanks for posting your code.
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •