0
以下のコードはグループ化された図形を考慮していません。回避策はありますか?シート内のすべての(グループ化されていても)形状を再検討する/ EXCEL VBA
Sub LoopThruShapes()
Dim sh As Shape
i=1
For Each sh In ActiveSheet.Shapes
Cells(i, 1).value = sh.name
Next
End Sub
ソース:ためのExcel平らにグループ化された形状は、グループ、上記のコードは、サブグループを識別しない、それ自体である場合
Sub test()
EnumShapes ActiveSheet.shapes
End Sub
Function EnumShapes(shps As Shapes)
Dim shp As Shape
Dim subshp As Shape
For Each shp In shps
Debug.Print shp.Name
If shp.Type = msoGroup Then
For Each subshp In shp.GroupItems
Debug.Print Space(2) + subshp.Name
Next subshp
End If
Next shp
End Function
: http://www.java2s.com/Code/VBA-Excel-Access-Word/Excel/LoopingthroughaCollectionofShapes.htm