if I know the password, how do I remove it from a large no of ppts?

M

misha.lepetic

Hello

The idea is to be able to loop through a number of files in a source
folder and remove the password (open), then storing them in a target
folder.

I have had success in using this macro for both excel and word files
and am trying to adapt it for use in powerpoint, but when i try to
compile the code in the VBA editor it gets stuck on the Password
property ("Password:="), citing "named argument not found" in the
error message. What gives? And what else is wrong with this macro?

many thanks
|m|


Sub removePPTPwdNtwkDrv()
Dim oPres As Presentation
Dim fName As String
Const pwd = "PaSsWoRd" ' to be changed
Const pathToOpen = "C:\passwordFiles\" ' to be changed
Const pathToSave = "C:\noPassword\" ' to be changed

fName = Dir$(pathToOpen & "*.ppt")
If fName = "" Then
MsgBox "No *.ppt files in " & pathToOpen
End If

On Error GoTo FinalExit

While fName <> ""
Set oPres = Presentations.Open(FileName:=pathToOpen & fName,
Password:=pwd, AddToMRU:=False)
oPres.SaveAs FileName:=pathToSave & fName, Password:=""
oPres.Close SaveChanges:=0
fName = Dir$()
Wend

Exit Sub

FinalExit:

If Err.Number <> 0 Then
Select Case Err.Number
Case 1004:
MsgBox "Could not save " & pathToSave & fName
Case Else
MsgBox Err.Number & vbCr & Err.Description
End Select
End If
End Sub
 
B

Bill Dilworth

Sorry Misha,

The password hook is not reveled in the PowerPoint object model.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
M

misha.lepetic

Hi Bill

Well, bugger that then. Definitely one for the wishlist for the MS
team.

Nevertheless, thanks for your quick response.

chrs
|m|
 

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