PowerPoint 2003 Automation

T

Tim

Is there a way to determine if a PowerPoint Presentation or SlideShow is
password protected (in terms of opening and editing where opening is my
principle concern) via Automation of PowerPoint 2003 (I'm using C++ incase
you are interested)?

It appears from what I have read about previous versions of other office
products (noteably word and excel) this is achieved by passing a nonsense
password into the Open method and catching the return/exception. However,
PowerPoint 2003 does not seem to offer this interface on its Open method (the
ability to supply a password)?

My major concern is that as this is hidden automation the password prompt
dialog will display and I will have to automate the entering of nonsense into
the password dialog but I wanted to check for ideas/advice before embarking
down this route.

Thanks in advance for any help on this!

Tim.
 
T

Tim

Apologies if this is best suited to the Automation newsgroup rather than this
PowerPoint group.

Tim
 
A

Austin Myers

Might this help? Haven't tried it but it says it's a read or write
property.

Returns or sets a String that represents a password that must be supplied to
open the specified presentation. Read/write.

expression.Password

expression Required. An expression that returns one of the objects in the
Applies To list.

Example
This example opens Earnings.ppt, sets a password for it, and then closes the
presentation.

Sub SetPassword()
With Presentations.Open(FileName:="C:\My Documents\Earnings.ppt")
.Password = complexstrPWD 'global variable
.Save
.Close
End With
End Sub
 
A

Austin Myers

Or you could just use something like this.

With ActivePresentation
If .PasswordEncryptionFileProperties = msoTrue Then
 
T

Tim

Thanks Austin I will try this - I must admit I had expected to have had to
open/load the presentation before being able to perform this test as I
thought the password prompt would have been displayed as soon as I attempted
to open/load the presentation into my application instance?

My previous code created an instance of a PowerPoint presentation and then
loaded in the actual document using the IPersist interface but this hangs on
load with password protected documents (fine with non-password protected
Presentations) I presume because it was prompting for password. (Using this
method, following a load, I could retrieve the Presentation IDispatch
interface)

I am in the process of changing the code to create an instance of a
PowerPoint application object which will Open the document through the
Presentations collection dispatch interface to enable me to try your
suggested method.

Thanks again and I will try this out.

Tim.
 
S

Shyam Pillai

Tim,
PPT does not provide any native interface to open password protected
presentation, not does it provide an interface to check for the same. When
you open a presentation that has been protected it will prompt for password
and halt all automation until input is provided. The workaround is to use a
timer to check whether the code has halted and send the password or dummy
password to the dialog that has popped up. If you search the google groups
archives of this newsgroup you should get the required bits of code.
 

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