none
VBA Macro to copy and paste from summary tasks in MS Project 2010 RRS feed

  • Question

  • Dear all,

    first of all happy new Year!

    Second: I am searching for a macro but not yet find. And i tried to do by my own but my VBA knowledge is to basic that it work.

    May someone can help me.

    I would like to have a macro, that goes trough all tasks in the active project file (MS Project 2010).

    For each task which is NOT a summary task he has to copy the content from "text2" of the previous summary to "text4" in the active task.

    Has someone any idea?

    Is it clear what I want?

    Thanks in advance.

    btw this is what I did until now but he do not write anything in text4:

    Sub Copy_WPNo()


    Dim t As Task
    Dim a As String

    For Each t In ActiveProject.Tasks
        If Not t Is Nothing Then
            If t.Summary = "True" Then
                On Error Resume Next
                a = t.Text2
            End If

            If t.Summary = "False" Then
                On Error Resume Next
                ActiveProject.Tasks(t).Text4 = a
            End If

        End If
    Next

    End Sub

    Br

    Tobias



    • Edited by der_toby Thursday, January 4, 2018 10:08 AM
    Thursday, January 4, 2018 10:01 AM

Answers

  • der_toby,

    This might work:

    Sub CopySumText()
    
        Dim T As Task
        For Each T In ActiveProject.Tasks
            If Not T Is Nothing Then
                If Not T.Summary Then
                    T.Text4 = T.OutlineParent.Text2
                End If
            End If
        Next T
    
    End Sub
    
    Good luck, tom

    • Marked as answer by der_toby Friday, January 5, 2018 10:11 AM
    Thursday, January 4, 2018 1:25 PM

All replies

  • der_toby,

    This might work:

    Sub CopySumText()
    
        Dim T As Task
        For Each T In ActiveProject.Tasks
            If Not T Is Nothing Then
                If Not T.Summary Then
                    T.Text4 = T.OutlineParent.Text2
                End If
            End If
        Next T
    
    End Sub
    
    Good luck, tom

    • Marked as answer by der_toby Friday, January 5, 2018 10:11 AM
    Thursday, January 4, 2018 1:25 PM
  • Tom,

    thanks it works!

    Br,

    Tobias

    Friday, January 5, 2018 10:10 AM