0

I'm having a bizarre error that I'm trying to figure out:

I have a PowerPoint template (.pptx) for a slide off in a shared drive and we always access it in code for our PPT VSTO. Inside that template, there's a slide that contains a chart. We can successfully load the template and the like and even locate the Shape.

I'm able to do the following:

Microsoft.Office.Interop.PowerPoint.Chart chart = shape.Chart; //shape corresponds to the Shape on the Slide
chart.Select(); //crashes

For some reason, every single time I try to Select the chart, it crashes with 0x800A03EC. I have absolutely no idea why.

Currently, our strategy is to store templates, load them, then access the ChartData inside of the Chart object. We have no ability to use OfficeXml, etc, because the presentation has to be opened and done in realtime. Is there, perhaps, a better way to attack this problem, or populate a chart's data?

Thanks in advance!

Locke
  • 1,133
  • 11
  • 32
  • 1
    I don't use VSTO, but I suspect your problem is trying to select the chart. You can't. You can select the shape then work with the Shape.Chart.[various properties]. Or better yet, don't select anything; get a reference to the shape and work with that. – Steve Rindsberg Sep 09 '14 at 20:00
  • Unusual. We've worked with Chart.Select() before and it works fine, except for when our destination presentation is an unusual type -- let me try that and see if it works. – Locke Sep 10 '14 at 12:28
  • So, I've tried again -- and now, I get a different Exception: "Shape (unknown member) : Invalid request. To select a shape, its view must be active." I've manually gone in and ensured that the current slide is selected, etc, and everything looks correct... I have no idea why this is occurring. The ViewType is Normal, application is selected, slide is selected, etc. – Locke Sep 10 '14 at 13:26
  • Final answer -- which is a bit weird -- if you already have the Shape selected, it'll freak out (for some reason, in my code). The result was to try to make a try { } catch {} around it -- and that seems to select the shape, if necessary, and otherwise, continue on. – Locke Sep 10 '14 at 13:59

0 Answers0