Automate PowerPoint with Embedded Excel

D

Dan

I have developed a .net PowerPoint AddIn to automate a presentation. Each slide contains an embedded spreadsheet, with an XML Map. The .net program accesses a database to retrieve an XmlDocument, and updates the XML Map using something like this

Slide slide = (Slide)myPresentation.Slides[1]
Shape shape = (Shape)slide.Shapes[1]
_Workbook workbook = (_Workbook)shape.OLEFormat.Object
XmlMap map = (XmlMap)workbook.XmlMaps[1]
map.ImportXml(xmlDoc.OuterXml, true)

In PowerPoint Normal view, this works fine - cells containing the XML map plus dependent cells are updated

However, in Slide Show mode, I generally get a COMException ("Object is not connected to server") on the 3rd line
If I catch the exception and repeat, the 3rd line succeeds and I get a NullReferenceException ("Invalid pointer") on the 4th line

Neither of these seems to be very consistent - it has worked at least once!

If anyone has experience of this, I would appreciate your help

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top