Can you password protect multiple excel files at once?
1 Expert Answer
Marco H. answered 06/27/19
Pro Ind Eng/Data Analyst Specializing in Access,Excel, VBA and SQL
Yes, you can. What you need is to save an Excel file as Macro Enabled File and run the VBA code below.
Sub OpenWorkBook_SetPassword()
Application.DisplayAlerts = False
Workbooks.Open "C:\Testing\File1.xlsx"
Workbooks("File1.xlsx").SaveAs Password:="File1"
Workbooks("File1.xlsx").Close
Workbooks.Open "C:\Testing\File2.xlsx"
Workbooks("File2.xlsx").SaveAs Password:="File2"
Workbooks("File2.xlsx").Close
Application.DisplayAlerts = True
End Sub
In this simple code, I tried to open two Excel files and set a password and close them step by step. In order to avoid any alerts, we have to turn them off at the beginning of the code and turn them back on before End sub. Using this method, you are able to set password on as many as Excel files you want.
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Susmitha S.
Can we do the same for multiple pdf file?12/18/20