![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
![]()
Hi Guys !
I was wondering whether its possible to use VBA to give a specific color to each level of the org chart (smart art) hierarchy. I know this can be done by editing the slide master, but my current requirement is to do it via VBA. Awaiting your help ! |
#2
|
|||
|
|||
![]()
If you loop through .AllNodes in a SmartArt Hierarchy you can check the level of each node and fill accordingly.
|
#3
|
|||
|
|||
![]()
Hi John,
I am still learning VBA, and coding this would be a bit tough for me. Therefore, I might need your expert advise to apply the below patterns for levels via VBA to my org chart. Level 1 (The head) - Blue Level 2 - Green Level 3 - Purple Level 4 - Yellow Level 5 - Orange Level 6 - Grey Level 7- Magenta Level 8 - Violet Awaiting your help. |
#4
|
|||
|
|||
![]()
Here is how to start (then it's up to you)
Code:
Sub SA_col() Dim oSA As SmartArt Dim L As Long 'smart art must be selected! Set oSA = ActiveWindow.Selection.ShapeRange(1).SmartArt For L = 1 To oSA.AllNodes.Count Select Case oSA.AllNodes(L).Level Case Is = 1 oSA.AllNodes(L).Shapes(1).Fill.ForeColor.RGB = RGB(0, 0, 255) 'blue Case Is = 2 oSA.AllNodes(L).Shapes(1).Fill.ForeColor.RGB = RGB(0, 255, 0) 'green 'etc for other levels End Select Next L End Sub |
#5
|
|||
|
|||
![]()
Hi John,
I just want to personally thank you for solving my issue. Brilliant piece of code ! Its been a great help to me ! |
#6
|
|||
|
|||
![]()
Hi John,
Thank you for your help thus far ! I just happened to noticed something, and I might need your advise to resolve this. Whilst the smart art node colors are changing accurately(based on levels), the connectors are still retaining the former colors. Would you be able to suggest how this too can be accomplished via the same code. Thanks a ton ! |
#7
|
|||
|
|||
![]()
AFAIK there's no way to do that in code.
|
#8
|
|||
|
|||
![]()
Hi John,
Sorry for the delayed response. Just want to thank you for all your help. Appreciate it !! |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
AD1983 | PowerPoint | 2 | 10-18-2016 06:26 AM |
![]() |
blockie | Word | 1 | 08-25-2014 11:19 PM |
![]() |
Cassik | PowerPoint | 5 | 11-04-2013 02:08 PM |
Custom colors for smart art - via template? theme? add-on? | fl8rmaus | PowerPoint | 0 | 09-26-2012 08:10 AM |
![]() |
abw1987 | Project | 3 | 10-05-2011 07:17 AM |