Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 05-22-2018, 04:42 AM
JohnWilson JohnWilson is offline VBA to add shapes to Smart Art Org Chart Windows 7 64bit VBA to add shapes to Smart Art Org Chart Office 2016
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

It's close but it needs a little more error checking

Code:
Sub addShape()

On Error Resume Next
If ActiveWindow.Selection.ShapeRange(1).HasSmartArt Then
If Err <> 0 Then
MsgBox "Select smart art"
Err.Clear
Exit Sub
End If
'so far so good
Debug.Print ActiveWindow.Selection.ChildShapeRange.Count
If Err <> 0 Then
MsgBox "No nodes selected"
Err.Clear
Exit Sub
End If
If ActiveWindow.Selection.ChildShapeRange.Count = 1 Then
CommandBars.ExecuteMso ("SmartArtAddShapeAfter")
'One node selected
Else
MsgBox "Select ONE node"
End If
End If 'not Smart art
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Smart Art Org Chart - Is it possible to give a custom RGB color for each level within the hiearchy R Mohan PowerPoint 7 04-30-2018 06:37 AM
Struggling with Smart Art R Mohan PowerPoint 5 04-24-2018 08:35 AM
Dynamic Smart Shapes? cloudforgiven Excel 0 11-21-2016 10:24 AM
VBA to add shapes to Smart Art Org Chart Smart Art - Updating a Chart AD1983 PowerPoint 2 10-18-2016 06:26 AM
Is there a smart art that would do this? raindog308 Drawing and Graphics 0 09-24-2010 04:23 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:29 AM.


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