Thread Subject: Error When Exporting Plot to Powerpoint

Subject: Error When Exporting Plot to Powerpoint

From: Ryan

Date: 2 Sep, 2009 14:47:02

Message: 1 of 4

Hello, I am trying to use a program that exports Matlab plots to Powerpoint. The program worked with Office 2003, but returns an error when used with Office 2007. The error is as follows:

*****
??? No appropriate method, property, or field Add for class
Interface.Microsoft_PowerPoint_12.0_Object_Library.Slides.

Error in ==> exportGeom2powerpnt>startPowerpnt at 41
      S1 = slides.Add(1,12);

Error in ==> exportGeom2powerpnt at 8
    [ppt, aP, sh] = startPowerpnt;

Error in ==> GearGen.drawGUI>export2PPT at 668
        exportGeom2powerpnt(gg);
 
??? Error while evaluating uicontrol Callback
*****

The section of code that is giving me problems is the following function:

%%%%%
function [ppt, aP, sh] = startPowerpnt

     ppt = actxserver('powerpoint.application');
           ppt.Visible = 1;
    pptP = ppt.Presentations;
           pptP.Add;
      aP = pptP.Item(1);
  slides = aP.Slides;
      S1 = slides.Add(1,12);
      sh = S1.Shapes;
 
return
%%%%%

I am wondering how to rewrite the code so that it works with Powerpoint 2007. Thanks for your ideas.

Subject: Error When Exporting Plot to Powerpoint

From: Aurelien Queffurust

Date: 2 Sep, 2009 15:12:04

Message: 2 of 4

"Ryan " <RMichael910@gmail.com> wrote in message <h7m0h6$oa1$1@fred.mathworks.com>...
> Hello, I am trying to use a program that exports Matlab plots to Powerpoint. The program worked with Office 2003, but returns an error when used with Office 2007. The error is as follows:
>
> *****
> ??? No appropriate method, property, or field Add for class
> Interface.Microsoft_PowerPoint_12.0_Object_Library.Slides.
>
> Error in ==> exportGeom2powerpnt>startPowerpnt at 41
> S1 = slides.Add(1,12);
>
> Error in ==> exportGeom2powerpnt at 8
> [ppt, aP, sh] = startPowerpnt;
>
> Error in ==> GearGen.drawGUI>export2PPT at 668
> exportGeom2powerpnt(gg);
>
> ??? Error while evaluating uicontrol Callback
> *****
>
> The section of code that is giving me problems is the following function:
>
> %%%%%
> function [ppt, aP, sh] = startPowerpnt
>
> ppt = actxserver('powerpoint.application');
> ppt.Visible = 1;
> pptP = ppt.Presentations;
> pptP.Add;
> aP = pptP.Item(1);
> slides = aP.Slides;
> S1 = slides.Add(1,12);
> sh = S1.Shapes;
>
> return
> %%%%%
>
> I am wondering how to rewrite the code so that it works with Powerpoint 2007. Thanks for your ideas.

On the French MATLAB forum : http://matlab.developpez.com/
one of users had this error by using pptwrite on the Fex:
http://www.mathworks.fr/matlabcentral/fileexchange/18457
he solved this issue with a newer version (saveppt2) fully tested on PowerPoint 2007:
http://www.mathworks.fr/matlabcentral/fileexchange/19322

Hope it helps,

Aur?lien

Subject: Error When Exporting Plot to Powerpoint

From: Ryan

Date: 2 Sep, 2009 21:34:01

Message: 3 of 4

Hi Aurelian,
Thanks that did the trick! For some reason you need to use the invoke function to call Add. I changed one line of code and it works!

Subject: Error When Exporting Plot to Powerpoint

From: fraser barrett

Date: 24 Jun, 2010 14:52:05

Message: 4 of 4

I've got exactly the same problem, with Add, but Invoking it doesn't seem to help. Could you explain precisely what your solution was?

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
saveppt2 Aurelien Queffurust 2 Sep, 2009 11:14:09
rssFeed for this Thread

Contact us at files@mathworks.com