Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change width or height of SmartArtNodes

Tags:

excel

vba

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?

like image 839
Michael Langhammer Avatar asked Nov 13 '15 13:11

Michael Langhammer


1 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
like image 194
Paidjo Avatar answered Oct 13 '22 13:10

Paidjo