Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem trying to open a PPT document and add slides to it

Subject: problem trying to open a PPT document and add slides to it

From: Tannistha

Date: 4 Dec, 2010 13:53:04

Message: 1 of 4

Hi all, i am using MATLAB 2009b and i have MS Office2003. i am running through some problem while trying to open an exisiting ppt presentation and/or adding slides to new presentation
 if i use this code:

ppt = actxserver('powerpoint.application');
ppt.Visible = 1;
>> ppt.Presentations.Open('Mytest.ppt');
comes error, the file is in the current MATLAB directory
??? Invoke Error, Dispatch Exception:
Source: Microsoft Office PowerPoint 2003
Description: PowerPoint could not open the file.
Help File:
Help Context ID: 0
 so i go to open a new presentation
ppt.Presentations.Add()
  now if i type this


Presentation.Slides.invoke
??? Undefined variable "Presentation" or class "Presentation.Slides.invoke".

Slide1=Presentation.Slides.Add(1)
??? Undefined variable "Presentation" or class "Presentation.Slides.Add".
 i tried another way

 Slide1= ppt.ActivePresentation.Slides.AddSlide
??? No appropriate method or public field AddSlide for class
Interface.Microsoft_PowerPoint_11.0_Object_Library.Slides.

all these methods i found out from whatever help file, help codes available at MATLAB central, i am stuck at step 1 itself and so i dont know how i am going to add text, text+images to slide one
 can anyone with experience please help?

Subject: problem trying to open a PPT document and add slides to it

From: Yair Altman

Date: 4 Dec, 2010 17:41:06

Message: 2 of 4

"Tannistha " <unculturedperson@gmail.com> wrote in message <iddh40$qm9$1@fred.mathworks.com>...
> Hi all, i am using MATLAB 2009b and i have MS Office2003. i am running through some problem while trying to open an exisiting ppt presentation and/or adding slides to new presentation

Use the OfficeDoc utility: http://www.mathworks.com/matlabcentral/fileexchange/15192-officedoc-read-write-format-ms-office-docs-xls-doc-ppt

Yair Altman
http://UndocumentedMatlab.com

Subject: problem trying to open a PPT document and add slides to it

From: Tannistha

Date: 4 Dec, 2010 19:07:04

Message: 3 of 4

thanks Yair, i already have downloaded the file.
 but i wanted to know where i am going wrong in trying to add a slide.
you see i have a GUI designed that imports data and performs calculations,plots images and then exports all the results in a standard powerpoint slide, with texts in each slide. So i was trying to develop the presentation on my own.
Your officedoc utility is extremely helpful, but at the same time i would like to you how can i myself open an existing presentation and add slides to it.

Subject: problem trying to open a PPT document and add slides to it

From: William

Date: 22 Dec, 2010 00:42:05

Message: 4 of 4

"Tannistha " <unculturedperson@gmail.com> wrote in message <iddh40$qm9$1@fred.mathworks.com>...
> Hi all, i am using MATLAB 2009b and i have MS Office2003. i am running through some problem while trying to open an exisiting ppt presentation and/or adding slides to new presentation
> if i use this code:
>
> ppt = actxserver('powerpoint.application');
> ppt.Visible = 1;
> >> ppt.Presentations.Open('Mytest.ppt');
> comes error, the file is in the current MATLAB directory
> ??? Invoke Error, Dispatch Exception:
> Source: Microsoft Office PowerPoint 2003
> Description: PowerPoint could not open the file.
> Help File:
> Help Context ID: 0
> so i go to open a new presentation
> ppt.Presentations.Add()
> now if i type this
>
>
> Presentation.Slides.invoke
> ??? Undefined variable "Presentation" or class "Presentation.Slides.invoke".
>
> Slide1=Presentation.Slides.Add(1)
> ??? Undefined variable "Presentation" or class "Presentation.Slides.Add".
> i tried another way
>
> Slide1= ppt.ActivePresentation.Slides.AddSlide
> ??? No appropriate method or public field AddSlide for class
> Interface.Microsoft_PowerPoint_11.0_Object_Library.Slides.
>
> all these methods i found out from whatever help file, help codes available at MATLAB central, i am stuck at step 1 itself and so i dont know how i am going to add text, text+images to slide one
> can anyone with experience please help?

Try this instead, it worked for me with office 2003

clearppt='Test.ppt'
ppt = actxserver('PowerPoint.Application');
%open presentation
op = invoke(ppt.Presentations,'Open',clearppt);

Tags for this Thread

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.

Contact us