none
Checking Summary Tasks for Successor entries in MSP RRS feed

  • Question

  • Hi All

    I am struggling with a snippet of code to check if there is a Successor assigned to a Summary Task.  My piece of code is beloe but when I run the code it is ignoring all Summary tasks and moving to actual tasks:

            If t.Summary Then
                If t.Successors <> "" Then
                    taskSumDepCt = taskSumDepCt + 1
                End If
            End If

    Any help appreciated.

    Kind regards

    Tony


    TKHussar

    Wednesday, June 10, 2015 8:53 AM

Answers

  • Hi John

    Your piece of code works fine on it's own.  However I think I have found the error now :-).  I had a line as follows which I think caused the issue:

    If (Not t Is Nothing) And (Not t.Summary) Then

    Thanks for your help.

    Tony


    TKHussar

    • Marked as answer by TKHussar Wednesday, June 10, 2015 5:08 PM
    Wednesday, June 10, 2015 5:08 PM

All replies

  • Wednesday, June 10, 2015 10:17 AM
    Moderator
  • Hi Rod

    Many thanks for your prompt response.  I have tried your suggestion but when I run the routine it is ignoring ANY Summary row so it does not get chance to test for anything in the Successor column of a Summary row.

    Thanks

    Tony


    TKHussar

    Wednesday, June 10, 2015 1:20 PM
  • Tony,

    I don't see anything wrong with the code snippet you show but it could fail for example if a filter is applied that filters out summary tasks and the code is part of a loop that looks at ActiveSelection.Tasks. In other words, it is difficult to say what may be wrong without showing more context around the code snippet.

    Does this simple macro work on your file?

    Sub summarylinks()
    Dim t As Task
    Dim Cnt As Integer
    For Each t In ActiveProject.Tasks
        If t.Summary Then
            If t.Successors <> "" Then Cnt = Cnt + 1
        End If
    Next t
    Debug.Print Cnt
    End Sub

    John

    Wednesday, June 10, 2015 2:15 PM
  • Hi John

    Your piece of code works fine on it's own.  However I think I have found the error now :-).  I had a line as follows which I think caused the issue:

    If (Not t Is Nothing) And (Not t.Summary) Then

    Thanks for your help.

    Tony


    TKHussar

    • Marked as answer by TKHussar Wednesday, June 10, 2015 5:08 PM
    Wednesday, June 10, 2015 5:08 PM
  • Tony,

    You're welcome and thanks for the feedback.

    John

    Wednesday, June 10, 2015 6:40 PM