Macro to Copy Custom Text Fields

H

Hadi

Hello Experts,

I have master file with about 50 subprojects inside. they're linked and all
posted on our Project Server 2003. I'm trying to find a way to popluate an
Enterprise Project Text Field in a batch fashion without having to open each
project file, and populate the data. So i opened the master project and all
of its subprojects. I populated the Enterprise Project Text Field at the
project name level (Outline level 1) using the Entry Table and then tried to
use the Macro below to fill down to the lower tier summary tasks and subtasks
but for some reason the Macro is not working...here is what i have

Sub TaskSummaryCustomField()
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
If t.OutlineLevel > 1 Then
t.EnterpriseProjectText21= = t.OutlineParent.EnterpriseProjectText21
End If
Next t
End Sub

I think i know the problem but dont know how to fix it. I think this Macro
works in a local file enviornment but not so much in a master/subproject
enviornment.

Thank you for your help

Hadi
 
J

Jack Dahlgren

This post belongs in the developer newsgroup, but since you are here...

You are correct that the macro only works at the master project level

You need to open each subproject in turn and run the code on them.

something like this:

Sub openMySubProjects()
Dim sProj As Project
Dim mProj As Project
Set mProj = ActiveProject 'this is the master project so we can go back to it

For Each Subproject In mProj.Subprojects
FileOpen (Subproject.Path)
Set sProj = ActiveProject 'not strictly necessary, but may be needed
MsgBox sProj.Name
'do other things to your subproject
Next Subproject
mProj.Activate 'go back to the master project when finished
End Sub

-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