Open password protected ppt files

B

Boss

Dim pptfile As Object
On Error Resume Next
Application.DisplayAlerts = false

Set pptfile = CreateObject("powerpoint.application")
pptfile.Visible = True

Set pshow = pptfile.Presentations.Open(FileItem, Password:="")

With pshow
.Password = "test" ' ppt password
.SaveAs FileItem
.Close
End With
pptfile.Quit
Application.DisplayAlerts = True
End If

How can i pass password from the vba code.
If the file does not have a password then it catches error.
Any help is greatly appreciated.

thx!
 

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