SmartArt with VBA in Microsoft Excel

With the help of SmartArt graphics, relationships, processes or hierarchies can be displayed quickly and clearly. For VBA, a SmartArt graphic is a group of shapes. However, the properties of the shapes can only be read, not changed. This option has only been available since Excel 2007. Below is a program that outputs the position of the individual blocks. The GroupItems collection includes all elements of the group. An individual element of the group can be addressed via an index. The Top and Left properties of the individual blocks are collected and output.

Sub SmartArtLesen()
Dim i As Integer
Dim s As String
Dim sh As Shape
' Erstes SmartArt-Objekt auswählen
Set sh = ThisWorkbook.Worksheets("Tabelle9").Shapes(1)
' Ort aller Elemente des SmartArt-Objekts
Fori=1Tosh.GroupItems.Count
s = s & Int(sh.GroupItems(i).Top) & _
" " & Int(sh.GroupItems(i).Left) & vbCrLf
Next i
MsgBox s
End Sub

Was the explanation to "SmartArt with VBA in Microsoft Excel"Helpful? Rate now:

Weitere Erklärungen zu Skriptsprachen