JSZ
JSZ

Reputation: 227

Delete powerpoint presentation if it exists

I'm trying to do something like this, here is my code:

% Start an ActiveX session with PowerPoint:
ppt = actxserver('PowerPoint.Application');

% If Powerpoint with this title exists
if exist(pptTitle,'file');
  % Delete presentation:
  invoke(ppt.Presentations,'Delete',pptTitle);
end

But Matlab doesn't recognize that command. Does anyone know how to delete a Powerpoint presentation from Matlab?

And as a secondary question, is there a command in Matlab to close the powerpoint application if it is open?

Upvotes: 0

Views: 257

Answers (1)

ranthero
ranthero

Reputation: 92

To check is the file exist and delete it:

  if exist(fileName, 'file')==2
      delete(fileName);
  end

Upvotes: 1

Related Questions