Removing worksheet protection from multiple workbooks

caman06

New Member
Joined
Aug 12, 2015
Messages
14
Hi Everyone,

Im hoping someone may be able to help me out.

I have a large selection of excel files within folders that I need to process.

Some files have protected worksheets and some don't

I have the password required but Im trying to find a way that I can get a macro to go through all the excel workbooks within a folder and sub folders, check if it has protected worksheets (of which there may be one or many), then unprotect all the worksheets, save the work book and close it then move on to the next.

The script I am using to unprotect all the worksheets is:

Sub ProtectAll()

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

any help would be greatly received thank you
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Is the password the same for all the worksheets in all the files?
 
Upvote 0
Yes it's the same password used to protect any of the sheets in all the files. It's just only about half of them have any protected worksheets in.
 
Upvote 0
What is the full path to the folder containing the files and sub folders? Do the files all have the same extension (xls, xlsx, xlsm)?
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top