VBA Macro for MS Project (Color Coded WBS)

Anonymous
2021-03-02T22:10:27+00:00

Hi There,

I'm trying to create a Color Coded MS Project Schedule to looks similar to my P6 Schedule.
But I guess that is only possible using VBA Macros, right? Or there is any other way?

Is there any code that I could use to do this?

Color:

Project Summary Task - RGB : 255 51 47

WBS Level 01 - RGB : 0 91 0
WBS Level 02 - RGB : 67 135 135

WBS Level 03 - RGB : 255 184 113

WBS Level 04 - RGB : 215 235 255
WBS Level 05 - RGB : 0 128 192

WBS Level 06 - RGB : 242 197 57

Activity Level - White (Typical)

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. John Project 49,695 Reputation points Volunteer Moderator
    2021-03-03T21:27:02+00:00

    ThiagoBM2021,

    Here ya go. I couldn't get your RBG colors to work, but this should give you a good start.

    John

    Sub HighlightSummaries()

    SelectAll

    EditClearFormats

    For i = 1 To 7

        FilterEdit Name:="OLX", taskfilter:=True, Create:=True, OverwriteExisting:=True, \_
    
            FieldName:="summary", test:="equals", Value:="yes", ShowInMenu:=False
    
        FilterEdit Name:="OLX", taskfilter:=True, Operation:="and", \_
    
            NewFieldName:="outline level", test:="equals", Value:=CStr(i)
    
        FilterApply Name:="OLX"
    
        SelectAll
    
        If ActiveSelection > 0 Then
    
            If i = 1 Then Font32Ex Color:=16777215, CellColor:=11892014
    
            If i = 2 Then Font32Ex CellColor:=8630772  'salmon
    
            If i = 3 Then Font32Ex CellColor:=15652797 'light blue
    
            If i = 4 Then Font32Ex Color:=16777215, CellColor:=9851951 'dark blue
    
            If i = 5 Then Font32Ex CellColor:=49407 'light grey
    
            If i = 6 Then Font32Ex CellColor:=12566463  'purple
    
            If i = 7 Then Font32Ex Color:=16777215, CellColor:=10498160
    
        Else
    
            Exit For
    
        End If
    
    Next i
    
    FilterApply Name:="all tasks"
    

    End Sub

    2 people found this answer helpful.
    0 comments No comments

10 additional answers

Sort by: Most helpful
  1. John Project 49,695 Reputation points Volunteer Moderator
    2021-03-03T02:14:43+00:00

    ThiagoBM2021,

    Yup, you need VBA to do that although you won't be able to get the colors down the left side.

    To be clear, are you really after the WBS level or do you perhaps mean Outline Level? In your screen shot I see 8 outline levels, not 6.

    John

    0 comments No comments
  2. Anonymous
    2021-03-03T03:18:37+00:00

    Hi John,

    Thanks for your repply.

    Yes, no worries about the "dow on the left side", would be great already just for each level of the summary rows in this case.

    The 6 Levels are enough, and yes I believe that would be the outline level as you said. In the real case, It will be more then one summary in each level, so I will have more than one in the same color/level.

    And the activity would be always white.

    0 comments No comments
  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Anonymous
    2021-03-03T19:01:42+00:00

    Thank you John.
    Really appreciate!

    0 comments No comments