Shapes.AddMediaObject not working on PPT 2013

  • Thread starter Thread starter joel
  • Start date Start date
J

joel

Hi

I have a C# program that calls PowerPoint methods through the Office InterOp.

The following line of code works in all previous versions of PPT:

PowerPoint.Shape soundShape = getCurrentSlideShapes(SlideId).AddMediaObject(soundfile, w - 20, h + 20, 20, 20);

where "soundfile" is the absolute path to a wav file

but when I run in on PPT 2013 it generates an exception:

Shapes (unknown member) : Invalid request. COMException errorcode -2147188160
80048240

(The "Invalid request" has no additional information)

To zero in on the problem I tried adding a regular shape:

PowerPoint.Shape soundShape = CurrentSlideShapes.AddShape(Office.MsoAutoShapeType.msoShape10pointStar , sLeft, sTop, sWidth, sHeight);

and that worked - so the InterOp is working.

I also tried using AddMediaObject with only the file name parameter and also with an explicit path and continued to get the same error.

Any ideas?

Thanks

Joel
 
Hi



I have a C# program that calls PowerPoint methods through the Office InterOp.



The following line of code works in all previous versions of PPT:



PowerPoint.Shape soundShape = getCurrentSlideShapes(SlideId).AddMediaObject(soundfile, w - 20, h + 20, 20, 20);



where "soundfile" is the absolute path to a wav file



but when I run in on PPT 2013 it generates an exception:



Shapes (unknown member) : Invalid request. COMException errorcode -2147188160

80048240



(The "Invalid request" has no additional information)



To zero in on the problem I tried adding a regular shape:



PowerPoint.Shape soundShape = CurrentSlideShapes.AddShape(Office.MsoAutoShapeType.msoShape10pointStar , sLeft, sTop, sWidth, sHeight);



and that worked - so the InterOp is working.



I also tried using AddMediaObject with only the file name parameter and also with an explicit path and continued to get the same error.



Any ideas?



Thanks



Joel

ok, I discovered the answer: AddMediaObject simply does not work in PPT 2013. However, AddMediaObject2 does work and so saves the day. Plus you get control over linking and/or saving the sound file with the presentation, which is a good thing.

Joel
 
Back
Top