Quantcast
Channel: General Office Development forum
Viewing all articles
Browse latest Browse all 2257

Selection.Type == ppSelectionShapes, but Selection.ShapeRange is empty.

$
0
0

Hi,

I found a possible bug in PowerPoint 2013 (with all Updates).

To reproduce this do following.

  1. Open a new blank presentation.
  2. Add any chart on the first slide
  3. Now add any shape (e. g. Oval) inside the chart of 2). If you are moving the chart, the shape must be moved too.
  4. Select the inserted shape

Now if you run following code, you get an error ("Integer out of range. 1 is not in the valid range of 1 to 0.")
In debugger I can see that Selection.ShapeRange is empty, even though Selection.Type == ppSelectionShapes.

if (PowerPointApp.ActiveWindow.Selection.Type == MSPowerPoint.PpSelectionType.ppSelectionShapes) { MSPowerPoint.Shape shape = PowerPointApp.ActiveWindow.Selection.ShapeRange[1]; if (PowerPointApp.ActiveWindow.Selection.HasChildShapeRange) { shape = PowerPointApp.ActiveWindow.Selection.ChildShapeRange[1]; }

// Do something with shape

}

How can I get a reference to selected shape? I believe this is a Bug in PowerPoint.

Regards,
Daniel


Viewing all articles
Browse latest Browse all 2257


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>