none
VBA in MS Project RRS feed

  • Question

  • How do I do a nested loop in VBA for MS Project.

    I have a loop saying

    For Each t In ActiveProject.Tasks

      ……...

    Next

    Within this loop, I want to see if the Summary tasks is complete. If so I need to skip all of its tasks. So I need to put a statement

    Do while t.Summary = false

     Next

    loop

    How can I read a next task within the Do while loop

    So my final code should look like the below

    For Each t In ActiveProject.Tasks

     If t.Summary is not complete then

      do some thing...

     else

      Do while t.Summary = false

        Next  'Skip these records

      loop

     End if

    Next

    Saturday, August 22, 2020 7:43 PM

All replies

  • Did you consider the next loop too?

    For Each t In ActiveProject.Tasks

       If t.Summary Then

          do things...

       End if

    Next


    Why do you need a nested loop?

    Sunday, August 23, 2020 8:09 AM