Help!! unprotect active workbooks

src68

New Member
Joined
Jul 21, 2011
Messages
14
i have about 85 workbooks that need to be unprotected then saved.

is there a quick macro for that... i looked on search and then the first 4 pages... didn't find anything that fits.

thanks for you help.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi there,

I assume you have a password for them and aren't trying to crack them? If so you can use this:

Code:
Sub BulkUnProtect()

    Dim theWB As Workbook
    Dim fso As FileSystemObject: Set fso = New FileSystemObject
    Dim theFolder As Folder: Set theFolder = fso.GetFolder("YourFolderPath")
    Dim theFile As File
    
    On Error Resume Next
        For Each theFile In theFolder.Files
            If theFile.Type = "Microsoft Excel Worksheet" Then
                Set theWB = Workbooks.Open(theFile.Path)
                theWB.Unprotect ("YourPassw0rd")
                theWB.Close True
            End If
        Next theFile
    On Error GoTo 0
        
    Set theWB = Nothing
    Set fso = Nothing
    
End Sub

1. Put all your workbooks in a folder and put the folder path in the GetFolder above
2. Put the password in the unprotect above
3. Go to Tool -> References -> set a reference to Microsoft Scripting runtime
4. Run the macro...

Hope that helps, give me a shout if there're any bugs! =D
 
Upvote 0
umm i think we are talking about different things... it doesn't have a password at all.. i am not trying to 'crack' or anything... let me explain a little more... maybe im not making sense.. I have 79 workbooks and ea. workbook has one worksheet. I need to unprotect those worksheets in the workbook. and instead going into ea. workbook and unprotecting the worksheet... i was hoping for a way i could do it automatically through a Macro or something... is this still wrong to ask??

thx

and sorry if i am making a mistake asking this.... i saw some question on unprotecting worksheets in a single workbook so i thought it was ok to ask...
 
Upvote 0
If they have no password (just locked without having a password added) I would think you would replace:
Code:
theWB.Unprotect ("YourPassw0rd")
with:
Code:
theWB.Unprotect ("")
...in DailyDoseofData's code.
 
Upvote 0
Ok so from what I gather you are not look to crack; what you are saying is that the sheets are protected but without a password. Right?

If so:

Code:
Dim wks as WorkSheet

For Each wks in ThisWorkbook.WorkSheets
    wks.Unprotect
    'do stuff
    wks.Protect
Next wks
 
Upvote 0
correct... so i am opening all 79 workbooks and i want it to go into ea. workbook and go to the only sheet in ea. workbook and unprotect... all at once... i dont' want to have to run it for ea. workbook .... is there a way.. and
will this do that?

thx for responding so quickly.
 
Upvote 0

Forum statistics

Threads
1,203,728
Messages
6,057,021
Members
444,902
Latest member
ExerciseInFutility

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