Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    May 2003
    Thanked 0 Times in 0 Posts

    password protect multiple files at once (word 97)

    I have a client who was wondering how to password protect multiple files at once. They need a read-only and a full access password applied to like 250 word documents in a folder. Having the same password is ok, but we are trying to avoid manually passwording each file.
    If anyone knows of a utility that will do this, or a macro that can help that would be awesome.
    Platform - Word 97, windows 98.



  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Thanked 7 Times in 7 Posts

    Re: password protect multiple files at once (word 97)

    To set the document write reservation password and open password from a Macro you want something like...

    ActiveDocument.Saved = False
    ActiveDocument.WritePassword = strPwd1
    ActiveDocument.Password = strPwd2
    ActiveDocument.SaveAs WritePassword:=strPwd1, Password:=strPwd2


  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: password protect multiple files at once (word 97)

    Here is a macro that loops through ALL documents in a folder and uses Stuart's code to set passwords.

    Since I assume it is a one time thing, the macro is not fancy. In particular, you must type the full path of the folder, you can't browse for it. It could be made more user-friendly and modern if you want to use it often.

    Sub SetPasswords()
    Dim strPath As String
    Dim strFile As String
    Dim strPwd1 As String
    Dim strPwd2 As String
    Dim oDoc As Document

    On Error GoTo ErrHandler

    strPath = InputBox("Enter the path of the folder")
    If strPath = "" Then Exit Sub
    strPwd1 = InputBox("Enter the full access password")
    If strPwd1 = "" Then Exit Sub
    strPwd2 = InputBox("Enter the read password")
    If strPwd2 = "" Then Exit Sub

    strFile = Dir(strPath & "*.doc")
    Do While strFile <> ""
    Set oDoc = Documents.Open(strPath & "" & strFile)
    With oDoc
    .Saved = False
    .WritePassword = strPwd1
    .Password = strPwd2
    .SaveAs WritePassword:=strPwd1, Password:=strPwd2
    End With
    strFile = Dir

    Set oDoc = Nothing
    Exit Sub

    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
    End Sub

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Christchurch, New Zealand
    Thanked 0 Times in 0 Posts

    Re: password protect multiple files at once (word 97)

    I have many clients who need this type of protection. However, the network engineer or system administration does it on a folder basis and assigns specific rights for that folder to user groups. The documents themselves aren't passworded.

    These documents are legal precedents and form the basis for documents for specific clients. The user opens the read only precedent, uses Save As to save the document to the client folder and then makes changes, adds text etc as required. The resulting client document doesn't have any password protection on it.

    When we passworded the original precedents instead of applying access rights to the actual folder, the Save As kept the password and read only recommendation for the resulting client file and this caused all sorts of problems for the users.

    We have two types of user groups - Everyone - anyone in this group has read only access to the precedent folder/subfolders and Precedents - anyone in this group has full read/write access so that they can create, modify, delete files in the folder(s).

  5. #5
    New Lounger
    Join Date
    May 2003
    Thanked 0 Times in 0 Posts

    Re: password protect multiple files at once (word

    Karen, I understand entirely your point, however that is not what we needed in this situation - indeed we already have that. This solution is for when the documents get email around. The documents are QA stuff that staff regularly need to review etc. Obviously as soon as the document leaves the file system and get sent offsite it loses any permissions it had [img]/forums/images/smilies/smile.gif[/img]

    thanks to all those who replied - I will try out the above macro later today and see how it goes


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts