Trying to get the layer names from a group that are inside a group. I have the code the gets the layer from a group, but not group inside group. any ideas?
Dim pDoc As IMxDocument
Set pDoc = ThisDocument
Dim pMap As IMap
Set pMap = pDoc.FocusMap
Dim pCompLayer As ICompositeLayer
Dim pCompLayer_child As ILayer
Dim pGrplyr As IGroupLayer
Dim i As Integer
Dim l As Integer
Dim k As Integer
For i = 0 To pMap.LayerCount - 1
If TypeOf pMap.Layer(i) Is IGroupLayer Then
Set pCompLayer = pMap.Layer(i)
For l = 0 To pCompLayer.Count - 1
UserForm1.ComboBox1.AddItem pCompLayer.Layer(l).Name
' detect if group is within group?? stuck here
Set pCompLayer_child = pCompLayer.Layer(l)
If TypeOf pCompLayer_child Is IGroupLayer Then
Set pCompLayer_child = pCompLayer.Layer(l)
UserForm1.ComboBox1.AddItem pCompLayer_child.Name
End If
Next l
End If
Next i
UserForm1.Show
End Sub