Protected PPT files causing VB SaveAs and Close errors...

P

Paul

I have a VB app that uses automation to simply open a PPT and save it as JPG
slides. Everything is great until I've run into someone with a "protected"
powerpoint file - the powerpoint Presentation object will return an error on
SaveAs (which I understand), but worse, it will return an error on the
Close() method as well -- leaving the protected presentation open and
running in my PowerPoint object (and on the taskbar) which I don't want. I
just want to close that protected presentation and return an error message
to the user.

and the next question would be -- is there a brute force method to override
this protection?

Thanks.

-- Paul
 
P

Paul

Steve Rindsberg said:
By protection, I assume you mean a modify password (rather than an open
password)?

I misspoke on the "protection" -- I opened the file manually and it says
"The presentation cannot be edited because it contains a read-only embedded
font"

On the menu, File > Save, Save As..., Save as Web Page... are greyed out.
Close is not greyed out, and the file can be Closed via the menu without an
error.
Can you use the .Quit method on your PPT object?

I'd rather not .Quit the PowerPoint object because I was hoping to only have
to initialize it once at the top of the program and .Quit it once on exit of
the program, saving the overhead of starting PowerPoint with every file
conversion.... But if I have to, I guess that's the route I'll take....


-- Paul
 
M

Mike M.

Or - You could Add a new presentation through automation, insert slides from
file (or copy each slide), then save the new presentation. There error on
the close may be caused by PowerPoint thinking you modified the file so you
could reset the "dirty flag" using VB and then do the close.
 
P

Paul

Or - You could Add a new presentation through automation, insert slides
from
file (or copy each slide), then save the new presentation. There error on
the close may be caused by PowerPoint thinking you modified the file so
you
could reset the "dirty flag" using VB and then do the close.

Even if I set the Presentation.Saved property True, Close still fails.
Actually I get an error setting the Saved property. The error on the calls
to SaveAs, Saved, and Close() is identical:

"OLE IDispatch exception code 0 from Microsoft Office PowerPoint 2003:
Presentation.Saved : Invalid request. Presentation cannot be modified..."
"OLE IDispatch exception code 0 from Microsoft Office PowerPoint 2003:
Presentation.SaveAs : Invalid request. Presentation cannot be modified..."
"OLE IDispatch exception code 0 from Microsoft Office PowerPoint 2003:
Presentation.Close : Invalid request. Presentation cannot be modified..."

-- Paul
 
P

Paul

What's the specific error you get on Close? I wonder if there's a way to
narrow that down. For example, are you doing anything in the presentation
prior to closing?

See my answer to Mike M. above. I'm not doing a thing to the presentation,
simply:

..Open
..SaveAs
..Close

I tried putting .Saved = True before and after SaveAs with no effect...

-- Paul
 

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