views:

34

answers:

1

In most cases shape.Parent is the slide that contains the shape.

However, if you try to delete a a group and then press on undo (the shapes will reappear) but the child shapes will throw exception for both .Parent and .ParentGroup.

How can I find out the slide ID of a shape in the case above?

+2  A: 

I did your instructions and didn't have any problems. I added two shapes to an emtpy blank slide and and then deleted them both at the same time and then did Ctrl+Z. then I ran this in the immediate window -

?ActivePresentation.Slides(1).Shapes(1).Parent.SlideIndex

And it worked and showed a value of 1.

So then I thought you had these as a group, so i grouped the two shapes and did the same as above. And it worked just fine.

Mahin
it was in the case of a group.Are you using PowerPoint 2007? I checked it on this version.
I am using PPT 2007 and PPT 2010, it works on both of them. What do you get when you run `MsgBox ActivePresentation.Slides(1).Shapes(1).Parent.SlideIndex` ?
Mahin