Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying the Summary Task as a Field 1

Status
Not open for further replies.

lattefresco

IS-IT--Management
Jul 28, 2005
3
US
Hello,

I would like to be able to create a field (Parent) which provides the name of it's "parent" summary task...

Then I'd like to create another field (Grandparent) which displays the grandparent summary task.

And so on and so forth...

The objective is to be able to provide an XML report which allows me to display the summary tasks which precede a specific task. On a to-do list for instance, this will allow the Resource looking at the list to understand the context of that task. Currently, the tasks appear out of context and it is difficult to know what...

7/28/05 | QA Home Page

...refers to.

Being able to see...

7/28/05 | Project X | Site 1 | QA Home Page

...where "Site 1" is the parent summary task and "Project X" is the grandparent (or great-great-great grandparent summary) makes much more sense.

Any ideas?

Thanks!
 
This works (haven't tested it with levels above 6, though)

Sub stuff()
Dim t As Task
Dim txtParents As Variant
txtParents = Array(" ", " ", " ", " ", " ", " ", " ", " ", " ")
For Each t In ActiveProject.Tasks
If t.Summary Then
If t.OutlineLevel > 0 And t.OutlineLevel < 10 Then
txtParents(ActiveProject.Tasks(t.ID).OutlineLevel) = t.Name
End If
Else
On ActiveProject.Tasks(t.ID).OutlineLevel GoTo L1, L2, L3, L4, L5, L6, L7, L8, L9
L9:
ActiveProject.Tasks(t.ID).Text18 = txtParents(8)
L8:
ActiveProject.Tasks(t.ID).Text17 = txtParents(7)
L7:
ActiveProject.Tasks(t.ID).Text16 = txtParents(6)
L6:
ActiveProject.Tasks(t.ID).Text15 = txtParents(5)
L5:
ActiveProject.Tasks(t.ID).Text14 = txtParents(4)
L4:
ActiveProject.Tasks(t.ID).Text13 = txtParents(3)
L3:
ActiveProject.Tasks(t.ID).Text12 = txtParents(2)
L2:
ActiveProject.Tasks(t.ID).Text11 = txtParents(1)
L1:
L0:
End If

Next

End Sub
 
Thank you for the quick response!

Sorry to sound ignorant, but how exactly do I implement this solution?

Thanks!!
 
Open your project, start a VBA session, create a module, paste the code and run the code.

 
Great. Thank you.

I gave that a shot by creating a new macro and then running your code. I received a
-----------------
Run Time Error '91'

Object variable or With block variable not set
-----------------

When I debugged, it highlighted the line
"If t.Summary Then" in yellow.

Any ideas?

Thank you.
 
The word "macro" does not appear in my message.

Have a good weekend.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top