title: How to loop through immediately nested shapes in a group (VBA)
body: <p>I have a chart which I have made in Excel. Copied it manually to PowerPoint. Then I have ungrouped it twice. Then I have selected the axis shapes on the left (numbers, axis alone) and made a group. Then i have taken the rectangles of the Chart representing data, and grouped them as 1) one group for positive values and 2) one group for negative values. So I have 3 group of shapes now. I thought I could loop these three groups, but in GroupItems there are all the groups mixed together with other shapes. I came with the idea, that I could simply detect Sh.ParentGroup.Id to find out how many parents is present and to separate them on three groups by the ParentGroup.Id... So first thing I did is a simple loop trying to access Sh.ParentGroup.Id. However if I add a watch, it crashes on 4th iteration and the Visual Basic and PowerPoint, where I run the code, restarted.</p>
  <pre><code>For Each Sh In ActiveWindow.Selection.ShapeRange.GroupItems
  ' GroupParentsIDs(Sh.ParentGroup.Id) = Sh.ParentGroup.Id
  MsgBox &quot;&quot;
  Next Sh
  </code></pre>
  <ol>
  <li>Do you have idea why it crashes? Should I detect if the ParentGroup member exists? If it is needed to check it, then how?</li>
  <li>Any other tips how to make it possible to differentiate between the three groups of shapes?</li>
  </ol>