Home » excel » excel – Change width or height of SmartArtNodes

excel – Change width or height of SmartArtNodes

Posted by: admin March 9, 2020 Leave a comment


Is it possible to change the width or hight of a SmartArtNode?

Following code doesn’t work at at all:

' mySmartArt is a SmartArt Object
mySmartArt.AllNodes.Item(1).Shapes.Width = 4

Strangely enough it works if you change the width of a shape. So I have no clue why Shape Objects of SmartArtNodes can not be resized at all. The only way I know is using the method larger or smaller, but using this method it’s not possible to only change the width/high of a shape.

If I use the code above, I’ll always get a RunTime Error “Object doesn’t support this action (Error 445)”, which is strange because via the GUI of Excel I can change the width and height of single Nodes of the SmartArt without a problem. So it doesn’t make any sense why it shouldn’t be possible to change it via VBA.

Has someone an idea how I can solve this problem?

How to&Answers:

Like this?

Sub Macro1()

Dim Sma As Shape
Set Sma = ActiveSheet.Shapes.AddSmartArt(Application.SmartArtLayouts(2))

With Sma
    .ScaleHeight 1.5, msoFalse, msoScaleFromBottomRight
    .ScaleWidth 1.5, msoFalse, msoScaleFromTopLeft
End With

End Sub