The following code is what I have at this time to password protect an individual file when it is open.
When I run it it simply pops up a screen asking me to enter the password I want to protect the file with, I enter the file then click ok.
What I'm looking for is a a code that instead when run I want to 1st prompt me to select a directory and once selected have a 2nd prompt asking me to enter the password of my choice then lastly open each file within the chosen directory, protect it using the password just entered and saved. Can anyone assist?
When I run it it simply pops up a screen asking me to enter the password I want to protect the file with, I enter the file then click ok.
Code:
Sub Protect_sheets()
Dim wSheet As Worksheet
Dim Pwd As String
Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
For Each wSheet In Worksheets
wSheet.Protect Password:=Pwd
Next wSheet
End Sub
What I'm looking for is a a code that instead when run I want to 1st prompt me to select a directory and once selected have a 2nd prompt asking me to enter the password of my choice then lastly open each file within the chosen directory, protect it using the password just entered and saved. Can anyone assist?