Share via

Excel remove password multiple files on network

Anonymous
2016-06-28T18:04:50+00:00

I need to remove the workbook open password (which is the same) to multiple files on our network.  I found a code dated back in 2014 by Graham Mayor; however, I am unable to hide or set automatic update all links.  I tried many UpdateLink= or := options to no prevail.

Please help

Thanks 

Here is the code G. Mayor posted

Sub RemovePasswords()

Dim xlBook As Workbook

Dim strFilename As String

Const fPath As String = "C:\Path"        'The folder to process, must end with ""

Const strPassword As String = "openpassword"        'case sensitive

Const strEditPassword As String = "editpassword" 'If no password use ""

    strFilename = Dir$(fPath & "*.xls") 'will open xls & xlsx etc

    While Len(strFilename) <> 0

        Application.DisplayAlerts = False

        Set xlBook = Workbooks.Open(Filename:=fPath & strFilename, _

                                    Password:=strPassword, _

                                    WriteResPassword:=strEditPassword)

        xlBook.SaveAs Filename:=fPath & strFilename, _

                      Password:="", _

                      WriteResPassword:="", _

                      CreateBackup:=True

        xlBook.Close 0

        Application.DisplayAlerts = True

        strFilename = Dir$()

    Wend

End Sub

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2016-06-28T18:57:28+00:00

It took some trials and errors, but I got it working.

change the following code

Set xlBook = Workbooks.Open(Filename:=fPath & strFilename, _

                                    Password:=strPassword, _

                                    WriteResPassword:=strEditPassword, _

                                     UpdateLinks:=0) ' to do not update links (or 3 to update links)

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2016-06-29T14:21:05+00:00

    Hello,

    Glad to know that your issue/query about removing password from multiple Excel files on network is resolved. I am sure your resolution will help others facing similar issues.

    Thank you.

    Was this answer helpful?

    0 comments No comments