Change the width or height of SmartArtNodes

Can I change the width or height of SmartArtNode?

The following code does not work at all:

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

Oddly enough, it works if you change the width of the shape. Therefore, I do not know why Shape Objects from SmartArtNodes cannot be modified at all. The only way I know is to use the method more or less, but using this method it is not possible to change the width / height of the form.

If I use the code above, I always get a RunTime error "The object does not support this action (Error 445)," which is strange because through the Excel GUI I can change the width and height of one SmartArt Nodes without problems. Therefore, it makes no sense why it cannot be changed using VBA.

Does anyone know how I can solve this problem?

+7
vba excel-vba excel
source share
1 answer

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 
+1
source share

All Articles