Hi
Is there a way to change the password (will all be same password) on several Word documents in one go please?
Thanks :-)
Technology Tips and News
Hi
Is there a way to change the password (will all be same password) on several Word documents in one go please?
Thanks :-)
Hi supanova,
Please try to use this Macro to get your result:
Public Sub PasswordAll() Dim FirstLoop As Boolean Dim myFile As String Dim sPassword As String Dim PathToUse As String Dim myDoc As Document Dim Response As Long PathToUse = InputBox("Path To Use?", "Path", "D:\My Documents\Test\Merge\") sPassword = InputBox("Enter Password") On Error Resume Next Documents.Close SaveChanges:=wdPromptToSaveChanges FirstLoop = True myFile = Dir$(PathToUse & "*.doc") While myFile "" Set myDoc = Documents.Open(PathToUse & myFile) If FirstLoop Then With ActiveDocument .Password = sPassword .WritePassword = sPassword End With FirstLoop = False Response = MsgBox("Do you want to process " & _ "the rest of the files in this folder", vbYesNo) If Response = vbNo Then Exit Sub Else With ActiveDocument .Password = sPassword .WritePassword = sPassword End With End If myDoc.Close SaveChanges:=wdSaveChanges myFile = Dir$() Wend End Sub
To get more information, please refer to the answer of Graham Mayor from this link:
http://www.wordbanter.com/showthread.php?t=52758
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
Hope it's helpful.
Regards,
Emi Zhang
TechNet Community Su