none
MSProject macro: How to jump to next task in a list? RRS feed

  • Question

  • My project file has many groups of task as shown here:

    Task Name Start Finish
    R1 Mon 5/6/13 Mon 9/30/13
      T11 Mon 5/6/13 Mon 9/23/13
      T21 Tue 9/24/13 Tue 9/24/13
      T31 Wed 9/25/13 Thu 9/26/13
      T41 Mon 9/23/13 Fri 9/27/13
      T51 Mon 9/30/13 Mon 9/30/13
    R2 Mon 5/6/13 Mon 9/30/13
      T12 Mon 5/6/13 Mon 9/23/13
      T22 Tue 9/24/13 Tue 9/24/13
      T32 Wed 9/25/13 Thu 9/26/13
      T42 Mon 9/23/13 Fri 9/27/13
      T52 Mon 9/30/13 Mon 9/30/13
    R3 Mon 5/6/13 Mon 9/30/13
      T13 Mon 5/6/13 Mon 9/23/13
      T23 Tue 9/24/13 Tue 9/24/13
      T33 Wed 9/25/13 Thu 9/26/13
      T43 Mon 9/23/13 Fri 9/27/13
      T53 Mon 9/30/13 Mon 9/30/13

    I need to export this in the following format:

    Task name  Date1  Date2  Date3 Date 4
    R1 T11.Finish   T31.start T31.finish T51.start
    R2 T12.Finish  T32.start T32.finish T52.start
    R3 T13.Finish  T33.start T33.finish T53.start

    What is the easiest way to do this?

    Wednesday, September 25, 2013 11:16 PM

All replies

  • Hi,

    you will need to modify the "select case" part for sure, I can't imagin that your task have these names. But this may give you a starting point:

    Sub ReadDate()
    Dim T, C As Task
    
    For Each T In ActiveProject.Tasks
        If Not T Is Nothing Then
            If T.Summary Then
                col1 = T.Name
                For Each C In T.OutlineChildren
                    If Not C Is Nothing Then
                        Select Case Mid(C.Name, 2, 1)
                            Case "1"
                                col2 = C.Finish
                            Case "3"
                                col3 = C.Start
                                col4 = C.Finish
                            Case "5"
                                col5 = C.Start
                        End Select
                    End If
                Next C
                MsgBox col1 & ", " & col2 & ", " & col3 & ", " & col4 & ", " & col5
            End If
        End If
    Next T
    End Sub

    Success!
    Barbara

    Thursday, September 26, 2013 4:37 AM
    Moderator