Put copies of the documents you want to protect in a separate folder and run
the following macro on that folder having first set the required password in
the line
strPassword = "password"
Ensure that you can open the documents with that password before removing
the original unprotected versions.
Don't forget the password!
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Sub BatchSetPassword()
Dim myFile As String
Dim PathToUse As String
Dim MyDoc As Document
Dim iFld As Integer
Dim strPassword As String
strPassword = "password"
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With
If Documents.Count > 0 Then
Documents.Close savechanges:=wdPromptToSaveChanges
End If
If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If
myFile = Dir$(PathToUse & "*.do?")
While myFile <> ""
Set MyDoc = Documents.Open(PathToUse & myFile)
MyDoc.Password = strPassword
MyDoc.Close savechanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>