Share via


MS Project: Extra fields in views

Versions 2003 and earlier
 
Project has three sets of extra fields: one for Tasks, one for Resources and one for Assignments.  Each one is unique and not automatically linked to the other two.  Data entered in extra fields for tasks are not copied into the Resource or Assignment fields with same name. For example, if a Text1 field is created for a particular use in the Gantt Chart view, data in that field cannot be seen in any Resource view or in a resource or assignment row of either Usage view. Task Text1 data will however appear in Task rows of the Task Usage view. Likewise Resource Text1 data will appear in Resource rows of the Resource Usage view. See also [MS Project: Data Types - Task, Resource, Assignment http://social.technet.microsoft.com/wiki/contents/articles/31991.ms-project-data-types-task-resource-assignment.aspx]
 
Transferring data between like fields of different data types requires a VBA macro. The following macro will transfer the content of a Task Text field into the Assignment Text field:
 
Sub TransferTaskText1ToAssignmentText1()
Dim t As Task
Dim a As Assignment
On Error Resume Next
    For Each t In ActiveProject.Tasks
        For Each a In t.Assignments
            a.Text1 = t.Text1
        Next a
    Next t
End Sub
 
Version 2007 and Later
 
Starting with Project 2007, two sets of extra fields were added for Assignments, one appears in the Task Usage view, the other in the Resource Usage view.  Each is unique and their content cannot be read or seen in the other view.
 
Copying data from task extra fields into Task Usage extra fields, and copying data from resource extra fields into Resource Usage extra fields, can be achieved automatically when customizing the field through Tools, Customize, Fields: check on “Roll down unless manually entered”.
 
The following macro will transfer data from a Task Text field into both assignment Text fields, thus making it visible in both Usage Views:
 
Sub Task_CF_To_Resource_Usage()
Dim Reso As Resource
Dim Task_As As Assignment
Dim Reso_As As Assignment
Dim Job As Task
For Each Job In ActiveProject.Tasks
    If Not Job Is Nothing Then
        For Each Task_As In Job.Assignments
            Task_As.Text1 = Job.Text1
            Set Reso = ActiveProject.Resources(Task_As.ResourceID)
            For Each Reso_As In Reso.Assignments
                If Reso_As.TaskID = Job.ID Then
                    Reso_As.Text1 = Task_As.Text1
                End If 'TaskID
            Next Reso_As
        Next Task_As
    End If 'Nothing
Next Job
End Sub
 
And a macro that will copy data from a resource text field into both Usage Views:
 
Sub Resource_CF_To_Task_Usage()
Dim Reso As Resource
Dim Task_As As Assignment
Dim Reso_As As Assignment
Dim Job As Task
For Each Reso In ActiveProject.Resources
    If Not Reso Is Nothing Then
        For Each Reso_As In Reso.Assignments
            Reso_As.Text2 = Reso.Text2
            Set Job = ActiveProject.Tasks(Reso_As.TaskID)
            For Each Task_As In Job.Assignments
                If Task_As.ResourceID = Reso.ID Then
                    Task_As.Text2 = Reso_As.Text2
                End If 'TaskID
            Next Task_As
        Next Reso_As
    End If 'Nothing
Next Reso
End Sub

Note: macro code written by Jan De Messemaeker, Project MVP

This is a translation of the Project MVP FAQ 37: http://project.mvps.org/faqs.htm#Custom%20Fields%20in%20Tables