2016-07-11 2 views

답변

2

: 그룹화 된 모양 자체가 그룹의 경우

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 

을 위의 코드를 하위 그룹을 식별하지 않습니다, 엑셀 평평하기 때문에 GroupItems 컬렉션의 셰이프는 있지만 셰이프를 모두 열거합니다 (깊이에 관계없이).

이 같은 출력을 얻을 것이다 :

Rectangle 1 
Group 4 
    Rectangle 2 
    Rectangle 3 
Group 12 
    Rectangle 6 
    Rectangle 7 
    Rectangle 9 
    Rectangle 10 
관련 문제