none
Show resource graph by Project grouping RRS feed

  • Question

  • I create a custom field called "Program Type" to group tasks. I have resource pool setup to share resource between all programs. Each resource can work on multiple programs.

    -In Master Plan, is it possible to add "Program Type" which is a custom field in Task view to resource usage? Someone mentioned that Task and Resource views have different set of custom fields. Is that correct? And what are common fields between these two views?

    -If I can add "Program Type" to resource usage, I can filter to only show resources used by specific program. However, is it possible to show resource graph, only selected resources, by filtered program type?

    Tuesday, November 15, 2011 5:31 PM

Answers

  • Mimi,

    It sounds like something is wrong with your object library references. From the VB Editor, go to Tools/References. As a minimum you should see the following references checked. If any are not, find them the select them. Then try the macro again:

    Visual Basic for Applications

    Microsoft Project 12.0 Object Library (I'm assuming your using Project 2007)

    OLE Automation

    You might also have:

    Microsoft Office 12.0 Object Library (if you have Office 2007 installed, otherwise it will be Office 14.0)

    John

    Tuesday, December 6, 2011 4:58 PM

All replies

  • Run this code. It assumes your "Program Type" field is Text1.

    Sub Rolldown()
    Dim T As Task
    Dim A As Assignment
    Dim R As Resource
    
    For Each R In ActiveProject.Resources
        If Not (R Is Nothing) Then
            For Each A In R.Assignments
                A.Text1 = A.Task.Text1
            Next A
        End If
    Next R
    
    End Sub
    

    Now create a Grouping that looks like this:

    Make sure that you check the box "Group Assignments, not Resources" BEFORE you add the group by elements.

    then apply this grouping to the Resource Usage view.

     

    Be sure to test this on a non production project first.

     

     

     

     

     

     


    Brian Kennemer – DeltaBahn Senior Architect
    Blog | Twitter | LinkedIn
    Tuesday, November 15, 2011 5:51 PM
    Moderator
  • Hi Brian,

    Seem like VB code is working perfectly. Wondering if I have to run this code everytime after I open a file?

    Next question is after i can classify resources by program type, i can still cannot see resource graph by resource by program type. Ex. John is working on Program A and B, when I select John name, John's Resource graph still shows all his workload both Program A and B. Do you have VB code where it'll only show resource graph for selected resource and selected program ? 

    Wednesday, November 23, 2011 2:04 AM
  • Mimi,

    I think this post is overshadowed by your other post as the basic answer is that you will need to export the data to Excel. Unfortunately Project's graphing capabilities are very limited.

    To answer your question about VBA code. You will only need to run the code if something has changed in the file that impacts the custom field you have designated as "Program type". For example, if you assign John to work on program "C" along in addition to programs "A" and "B", then you must re-run the code to populate the assignment field in the Resource Usage view.

    If you agree that this post is complete, please mark it as answered so it will be closed.

    John

    Wednesday, November 23, 2011 4:37 PM
  • I now added this code to Project 2007 standard, but got an error message "Object doesn't support this properties or method". When I chose Debug, software highlighted "A.Text1 = A.Task.Text1". This code works fine before in Project 2010. How should I correct it?
    Monday, December 5, 2011 2:06 PM
  • mimi,

    Apparently the object model has changed in this area. There may be alternate ways to do this but the following will work in Project 2007:

    A.Text1 = ActiveProject.Tasks(A.TaskID).Text1

    Note, this also works with Project 2010. Sometimes it is better to avoid using new VBA object model methods, properties, etc. because doing so means the code will not be compatible with previous versions of Project. However, code written using older methods, properties, etc. normally work fine in newer versions of Project. 

    Hope this helps.

    John



    Monday, December 5, 2011 4:47 PM
  • Hi John,

    I paste the following code to VBA Project (Project A) -> Microsoft Project Objects -> ThisProject (Project A) and still got an error "Application-defined or Object-defined error". Please advise.

    Sub Rolldown()
    Dim T As Task
    Dim A As Assignment
    Dim R As Resource

    For Each R In ActiveProject.Resources
        If Not (R Is Nothing) Then
            For Each A In R.Assignments
                A.Text1 = ActiveProject.Tasks(A.TaskID).Text1
            Next A
        End If
    Next R

    End Sub

     

    Tuesday, December 6, 2011 3:06 PM
  • Mimi,

    It sounds like something is wrong with your object library references. From the VB Editor, go to Tools/References. As a minimum you should see the following references checked. If any are not, find them the select them. Then try the macro again:

    Visual Basic for Applications

    Microsoft Project 12.0 Object Library (I'm assuming your using Project 2007)

    OLE Automation

    You might also have:

    Microsoft Office 12.0 Object Library (if you have Office 2007 installed, otherwise it will be Office 14.0)

    John

    Tuesday, December 6, 2011 4:58 PM