Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-23-2018, 12:43 PM
R Mohan R Mohan is offline Struggling with Smart Art Windows 8 Struggling with Smart Art Office 2016
Novice
Struggling with Smart Art
 
Join Date: Apr 2018
Posts: 15
R Mohan is on a distinguished road
Default Struggling with Smart Art

Hi All !

I need to build a code (using powerpoint VBA), which will change the color of the of the selected element within the org chart smart art into red.

I would be grateful if someone could help me with this !!

Regards,


RM
Reply With Quote
  #2  
Old 04-24-2018, 05:42 AM
JohnWilson JohnWilson is offline Struggling with Smart Art Windows 7 64bit Struggling with Smart Art Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,823
JohnWilson will become famous soon enoughJohnWilson will become famous soon enough
Default

Code:
Sub chexSA()

Dim osubshp As Shape
Dim oshp As Shape
On Error GoTo err
Set oshp = ActiveWindow.Selection.ShapeRange(1)
If Not oshp.HasSmartArt Then
MsgBox "This does not look like you have a Smart Art shape selected!", vbCritical
Exit Sub
End If
Set osubshp = ActiveWindow.Selection.ChildShapeRange(1)
osubshp.Fill.ForeColor.RGB = vbRed
Exit Sub
err:
MsgBox "Is a shape selected?", vbCritical
End Sub
__________________
Microsoft PowerPoint MVP
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 04-24-2018, 06:18 AM
R Mohan R Mohan is offline Struggling with Smart Art Windows 8 Struggling with Smart Art Office 2016
Novice
Struggling with Smart Art
 
Join Date: Apr 2018
Posts: 15
R Mohan is on a distinguished road
Default

Quote:
Originally Posted by JohnWilson View Post
Code:
Sub chexSA()

Dim osubshp As Shape
Dim oshp As Shape
On Error GoTo err
Set oshp = ActiveWindow.Selection.ShapeRange(1)
If Not oshp.HasSmartArt Then
MsgBox "This does not look like you have a Smart Art shape selected!", vbCritical
Exit Sub
End If
Set osubshp = ActiveWindow.Selection.ChildShapeRange(1)
osubshp.Fill.ForeColor.RGB = vbRed
Exit Sub
err:
MsgBox "Is a shape selected?", vbCritical
End Sub
Hi John,

Amazing, thanks a ton !!

Appreciate your timely and accurate response !
Reply With Quote
  #4  
Old 04-24-2018, 06:39 AM
R Mohan R Mohan is offline Struggling with Smart Art Windows 8 Struggling with Smart Art Office 2016
Novice
Struggling with Smart Art
 
Join Date: Apr 2018
Posts: 15
R Mohan is on a distinguished road
Default

Hi John,

How do I get this code to work if the user has selected more than one node within the Org chart.

Awaiting your help.
Reply With Quote
  #5  
Old 04-24-2018, 07:44 AM
JohnWilson JohnWilson is offline Struggling with Smart Art Windows 7 64bit Struggling with Smart Art Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,823
JohnWilson will become famous soon enoughJohnWilson will become famous soon enough
Default

Code:
Sub chexSA()

Dim osubshp As Shape
Dim oshp As Shape
On Error GoTo err
Set oshp = ActiveWindow.Selection.ShapeRange(1)
If Not oshp.HasSmartArt Then
MsgBox "This does not look like you have a Smart Art shape selected!", vbCritical
Exit Sub
End If
For Each osubshp In ActiveWindow.Selection.ChildShapeRange
osubshp.Fill.ForeColor.RGB = vbRed
Next
Exit Sub
err:
MsgBox "Is a shape selected?", vbCritical
End Sub
__________________
Microsoft PowerPoint MVP
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #6  
Old 04-24-2018, 08:35 AM
R Mohan R Mohan is offline Struggling with Smart Art Windows 8 Struggling with Smart Art Office 2016
Novice
Struggling with Smart Art
 
Join Date: Apr 2018
Posts: 15
R Mohan is on a distinguished road
Default Thank you John !!

Hi John,

Amazing ! !

Thank you so much.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Struggling with this one. In-line Cell formatting again TJMorgan Excel Programming 9 02-16-2017 10:37 AM
Struggling with Smart Art I'm struggling to do a Vlookup in MS office 16 LadyG Excel 6 01-26-2017 09:49 AM
Struggling with Smart Art Struggling with a layout issue. Need Help, Please! Moondoggy Word 2 08-08-2016 07:38 PM
Struggling with Smart Art struggling with simple task jayhammond Word VBA 3 03-04-2016 08:58 AM
Struggling with Smart Art struggling with Excel formula riccam87 Excel 1 05-02-2014 07:21 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 06:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft