Any good way to batch color the Team Planner view? RRS feed

  • Question

  • Hi there, I'm trying to get a plugin up and running, and one of the things it is trying to do is a kind of conditional formatting for the Team Planner view.  The situation is basically that I have two resource groups (A & B), and each resource has a custom field that is the hex string for a color associated with that resource.  All the tasks in the project will have multiple resources assigned to them, one (or more) from group A and one (or more) from group B.

    I'm putting in some buttons like "Color by A" or "Color by B", which I'd like to have color the boxes in the Team Planner according to their associated color.

    So if I'm in the Team Planner and have the resources filtered by "Resource Group is A", I could "Color By B" and see the tasks for the team colored by who from Group B was also assigned to the task.

    The way I think I can get this going is something like:

     System.Drawing.Color color = this.stringToColor(res.GetField(resourceColorField));
     this.Application.ViewApply("Resource Usage");
     MSProject.PjAutoFilterType.pjAutoFilterCustom, "equals", res.Name);
     // The following seems to work around a bug where rows are not shown unless you hide/reshow subtasks
     this.Application.OutlineHideSubTasks(); this.Application.OutlineShowAllTasks();
     int row = 1;
     while (this.Application.ActiveSelection.Resources != null) {
           this.Application.ViewApply("Team Planner");
           this.Application.ViewApply("Resource Usage");

    Now this isn't working all that great yet, but it seems like with some tweaking it could get there.

    The question is "REALLY?!", isn't there an easier way to do this?  SelectTaskAssns seems like the only way to manage selection on the Team Planner, and it only seems to work on one assignment at a time.  So even if I do get the above algorithm working, and turn off screen updates, it'll still take forever to run since I have to do each coloring an assignment at a time, and switch views multiple times as I do it.  Is there an easier way to select all the assignments in the Team Planner for tasks who have a given resource assigned? 

    This is in Visual Studio 2010 and Project 2010 on Windows 7.

    Thanks for the help!

    -Rob Blau

    Monday, April 9, 2012 11:37 PM


All replies

  • The Team planner is limited. The SegmentFillColor command sets the color for all assignments for the selected task in the Team planner View. I don't think you can color only one assignment.

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management

    Thursday, April 12, 2012 9:38 AM
  • I'm working on something similar in Project 2007, which applies "Conditional Formatting" based on the value of the flag19 field. I'm finding performance to be alright (almost instant for 3,000 line schedule). It only formats the Gantt View, not the Team Planner (doesn't exist in 2007).

    Application.ScreenUpdating = False ' Attempt to stop the screen refreshing
    'Create (or refresh) the filters required to apply formatting
    FilterEdit name:="Flag19True", TaskFilter:=True, create:=True, OverwriteExisting:=True, fieldName:="Flag19", test:="equals", value:="Yes", showInMenu:=False, ShowSummaryTasks:=False
    FilterEdit name:="Flag19False", TaskFilter:=True, create:=True, OverwriteExisting:=True, fieldName:="Flag19", test:="equals", value:="No", showInMenu:=False, ShowSummaryTasks:=False
    'Apply the formatting to the standard Gantt Chart view
    ViewApply "Gantt Chart"
        FilterApply name:="Flag19True"
        SelectColumn 3, 1'  restricting to 2 columns only to fit with 64,000 cell constraint for formatting
        FontEx CellColor:=16, Pattern:=0
        FilterApply name:="Flag19False"
        SelectColumn 3, 1
        FontEx CellColor:=15, Pattern:=2
        FilterApply "&All Tasks"

    Thursday, April 12, 2012 5:00 PM
  • Yeah, formatting the Gantt was very doable and performance was fine since I was able to do something similar and filter for a particular format, apply it in batch, loop and then put things back how I found them.  Unfortunately it seems like the Team Planner is a completely different beast, but one that we're using a ton to see a nice condensed view of the Gantt.
    Thursday, April 12, 2012 8:01 PM
  • Hey Rod, thanks for the response.  Do you know of a way to manage the selection better in the Team Planner, or to filter and select the assignment boxes rather than the resource list?  I've had to table this feature and tell the folks I'm supporting that there is no way to do conditional formatting in the Team Planner effectively and they have to hand color things the way they want.  I'd love to have a better answer for them.


    Thursday, April 12, 2012 9:30 PM
  • What you've seen is what you get. I'm afraid I've found the Team Planner to be not very useful since once there are a number of tasks, I can't see the wood for the trees. I never reassign resources using Team Planner because it forces a date constraint on the affected tasks.

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management

    • Marked as answer by Rob Blau Saturday, April 14, 2012 10:14 PM
    Saturday, April 14, 2012 9:01 AM
  • Same here, but we use it as a great view to see a condensed version of the Gantt while having the task sheet open below.  Thanks for the info!


    Saturday, April 14, 2012 10:15 PM