Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect if ppt-file is WritePassword protected

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
Is it possible to detect if the ActivePresentation is protected using VBA ?
I was thinking of something like:
Code:
If ActivePresentation.WritePassword = "" Then
   MsgBox "Presentation is not write protected"
   ELSE
      With ActivePresentation
        .WritePassword = "Passwd"
        .SaveAs ActivePresentation.Name
End With
 
hi,

What did YOU discover?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
unless you are changing your password, why are you supplying the password?

and why the SaveAs using the same name?
Code:
If ActivePresentation.WritePassword = "" Then
      MsgBox "Presentation is not write protected"
ELSE
      With ActivePresentation            '[b]
        .WritePassword = "Passwd"        'why unless a new password???
        .SaveAs ActivePresentation.Name  'why SaveAs the SAME name???[/b]
      End With  
end if

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Displaying ActivePresentation.WritePassword gives always "*******" wether there is a protection password or not.
SaveAs "the same name" is used because this is the only option to add a modify password (I thought).
The goal is to detect if a opened presentation is modify protected...
If not protected then protect the document using ActivePresentation.WritePassword
If the presentation is protected then I need to open it using the password (not read only) to modify the presentation.

Summarized:
I want to write an addin that
- protects a presentation
- unprotects a presentation

I want to protect the presentation for distribution purposes and to unprotect the document for modifying the presentation without keeping two versions of the presentation (a protected version and an unprotected version)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top