Consulting

Results 1 to 8 of 8

Thread: Solved: MSP 2003 - Set flag from summary to task

  1. #1
    VBAX Regular
    Joined
    Dec 2006
    Posts
    30
    Location

    Solved: MSP 2003 - Set flag from summary to task

    I have a flag for inactive tasks. Whenever I change this flag for the summary task, I want all tasks within that summary to be updated accordingly.

    Before:
    Summary Task1 = Yes
    Task A = No
    Task B = No
    Task C = No

    After:
    Summary Task 1 = Yes
    Task A = Yes
    Task B = Yes
    Task B = Yes

    Thanks for your help.

  2. #2
    VBAX Regular
    Joined
    Sep 2007
    Posts
    16
    Location
    x
    Last edited by mallarym; 10-31-2007 at 06:44 AM.

  3. #3
    VBAX Regular
    Joined
    Sep 2007
    Posts
    16
    Location
    [vba]
    dim tk as task

    for each tk in activeproject.tasks

    if tk.outlineparent.flag1="Yes" then
    tk.flag1="Yes"
    end if
    next tk
    [/vba]
    Last edited by mallarym; 10-31-2007 at 06:46 AM.

  4. #4
    VBAX Regular
    Joined
    Dec 2006
    Posts
    30
    Location
    It doesn't seem to work.
    If have updated the VBA a little bit but now all tasks (summaries and non summaries) get updated.
    [VBA]For Each tk In ActiveProject.Tasks
    If tk.OutlineParent.EnterpriseFlag4 = True Then
    tk.EnterpriseFlag4 = "Yes"
    End If
    Next tk[/VBA]

    Any suggestions?

  5. #5
    VBAX Regular
    Joined
    Sep 2007
    Posts
    16
    Location
    ok, I need a little more information.

    How many levels of tasks do you have?

    When you say that all get updated, what do you mean exactly? (an common example like your first post would be helpful).

  6. #6
    VBAX Regular
    Joined
    Dec 2006
    Posts
    30
    Location
    I have tasks with one summary level.
    Belwo the result after running the VBA:

    Before:
    Summary Task1 = Yes
    Task A = No
    Task B = No
    Task C = No

    Summary Task2 = No
    Task D = No
    Task E = No
    Task F = No

    After:
    Summary Task1 = Yes
    Task A = Yes
    Task B = Yes
    Task C = Yes

    Summary Task2 = Yes
    Task D = Yes
    Task E = Yes
    Task F = Yes

    I expected that only task under summary task 1 would be Yes. All tasks under summary 2 should remain No.

    Thanks.

  7. #7
    VBAX Regular
    Joined
    Sep 2007
    Posts
    16
    Location
    Add a separate procedure to find your levels:
    [vba]Public Function NumberofDecimals(WBS As String) As Long

    Dim instr1 As Long
    Dim instr2 As Long
    Dim Level As Long
    instr1 = 1
    Level = 1

    Do
    instr2 = InStr(instr1, WBS, ".")
    If instr2 = 0 Then
    Exit Do
    Else
    instr1 = instr2 + 1
    Level = Level + 1
    End If
    Loop

    NumberofDecimals = Level

    End Function
    [/vba]

    Then modify your code for your flag's to:
    [vba]Dim tk As Task
    For Each tk In ActiveProject.Tasks
    Level = NumberofDecimals(tk.WBS)

    If Level > 1 And tk.OutlineParent.Flag1 = True Then
    tk.Flag1 = True
    End If
    Next tk[/vba]

  8. #8
    VBAX Regular
    Joined
    Dec 2006
    Posts
    30
    Location
    Thanks, it works!

Posting Permissions

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