Macro - copy outline level 0 down

H

Hadi

Hello Experts,

I have a project file where outline level 1 is the project name and then i
have 6 outline level 2 summary tasks and the rest are subtasks. I want to be
able to copy the outline level 1 activity down to all the tasks to Text1 (for
example). I have a macro that i got from somewhere online (after making some
changes), and it does the job. My questions is, if I change the structure
where the 6 summary tasks to Outline level 1 and show the project summary
task (which is outline level 0), how can i adjust the macro to work in that
arrangement? I tried changing it but was not successful. here is the macro i
have now:

Dim mystring As String
Dim mytask As Task
Dim myoutlinelevel As Integer
Dim t As Task
Dim val1 As String

myoutlinelevel = 1
For Each mytask In ActiveProject.Tasks
If Not (mytask Is Nothing) Then
If mytask.OutlineLevel = myoutlinelevel Then
mytask.Text1 = mytask.Name
End If
End If
Next mytask

OutlineShowTasks expandinsertedprojects:=True

SelectTaskColumn

For Each t In ActiveProject.Tasks

If Not t Is Nothing Then

If t.OutlineLevel = 1 Then

val1 = t.Text1

Else

t.Text1 = val1

End If

End If

Next t

End Sub
 
J

Jack Dahlgren

If you want to copy the custom field value from the project summary task

Sub copyfromSummarytoAll()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
t.Text1 = ActiveProject.ProjectSummaryTask.Name
End If
Next t
End Sub

I also have some other examples here:
http://masamiki.com/project/macros.htm

-Jack Dahlgren
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top