![]() |
|
#1
|
||||
|
||||
![]()
It appears the code I provided would only remove forms protection, not the open/write protection. Try the following instead:
Code:
Sub UnprotectDocuments() Application.ScreenUpdating = False Dim strFolder As String, strPwd As String, strFile As String, wdDoc As Document strPwd = InputBox("What is the password?", "File Password") If strPwd = "" Then Exit Sub strFolder = GetFolder If strFolder = "" Then Exit Sub strFile = Dir(strFolder & "\*.doc", vbNormal) While strFile <> "" Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, _ Visible:=False, PasswordDocument:=strPwd, WritePasswordDocument:=strPwd) With wdDoc '.ReadOnlyRecommended = False .Password = vbNullString .WritePassword = vbNullString .Close SaveChanges:=True End With strFile = Dir() Wend Set wdDoc = Nothing Application.ScreenUpdating = True End Sub Function GetFolder() As String Dim oFolder As Object GetFolder = "" Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0) If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path Set oFolder = Nothing End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Hi Macropod, yes that works great. In fact you have to go to each folder, it won't look into sub-folders but it did the job and saved a huge amount of time.
As for the error dialog box, I have discovered that by pure coincidence an update to Norton Internet Security 2012 came along the same day as I tried your first code; seems the Norton officeav.dll file is causing some problems and there are plenty of posts about it on the Internet. Disabling the Microsoft Office scan option in Norton stops it but how strange that it came along the same time as your code! Thanks again from a cold Hampshire UK |
#3
|
|||
|
|||
![]()
Hello Macropod,
I too was able to use your code,I'm glad Hantsdave started the thread. I posted a similar one and was directed to yours. The code works great for me (I have 150 +/- files to remove PW from)with the exception that I'm being prompted at each file save with a dilalogue box "this file is being saved with tracked changes".I hit ok and it moves on to the next file in the directory .I'd rather have it save only the "Final" Views,but seems as if it defaults to save with "Final showing Markups".How can I input into the code to automatically select FINAL? Thanks! |
![]() |
Tags |
password, protection, remove |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Did an auto-update remove password protection? | namedujour | Excel | 0 | 11-22-2011 07:40 AM |
Password Protection Problem | todobfl | Excel | 4 | 07-26-2011 06:40 PM |
![]() |
JimP | Visio | 2 | 03-24-2011 04:23 AM |
Help reg Protection of cell. | aligahk06 | Excel | 1 | 09-02-2009 05:45 PM |
Visio - password protection | icap5183 | Visio | 0 | 07-24-2009 06:00 AM |