I want to group a number of shapes in another slide. The task seems very simple. However, the problem is the shapes needed to be grouped is not on the current slide.
For example,
The current slide is slide number 2. My shapes needed to be grouped are on the slide number 10. When a shape on the slide number 10 get selected, it always causes error. It seems that, we cannot change the slide selection.
My code is follow:
PowerPoint.Slides allSlides = ppApp.ActivePresentation.Slides;
for (int i = 1; i <= allSlides.Count; i++)
{
PowerPoint.Slide slide = allSlides[i];
if (slide.SlideId == 10)
{
//- Select the slide first
slide.Select();
//- Select (assuming) shape1 and shape3
slide.Shapes[1].Select(); //- Error: The shape1 cannot be selected????
slide.Shapes[3].Select(Microsoft.Office.Core.MsoTriState.msoFalse);
PowerPoint.ShapeRange shapeRange = ppApp.ActiveWindow.Selection.ShapeRange;
shapeRange.Group();
}
}