'Unable to modify AutoShapeType of SmartArt nodes in VBA (Office 365 Excel)
I'm running into an error (445 - object doesn't support this action) when trying to modify the shape of the nodes in a SmartArt hierarchy diagram. This can be done using the Format ribbon, just like for any other shape, but in VBA is doesn't seem to allow it. This is the code I've tried:
Dim oSmArt As Shape
Set oSmArt = ActiveSheet.Shapes.AddSmartArt(Application.SmartArtLayouts(97))
With oSmArt.SmartArt.AllNodes(1).Shapes(1)
'These all work:
.Fill.ForeColor.ObjectThemeColor = msoThemeColorAccent2
.Line.ForeColor.RGB = RGB(0, 0, 0)
.Line.Weight = 3
.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(0, 0, 0)
'This doesn't:
.AutoShapeType = msoShapeRoundedRectangle
End With
The penultimate line has the error. Since the node shapes can be changed I assume it should be possible somehow, but the Shape.AutoShapeType property doesn't seem to work (despite Fill and Line working fine).
Does anyone have any suggestions?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
