• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Unprotect all sheets

Status
Not open for further replies.

Abhijeet

Active Member
Hi

I have 300 files & every file has 5 sheets i want all sheets Unprotect.I have macro but this macro unprotect active sheet only please tell me how to Unprotect every sheets of each files in folder
 

Attachments

  • Password Break.xlsm
    11.3 KB · Views: 7
I failed to understand your password..
But this will be do what are u looking for.

Code:
Sub unprotect()
Dim ws As Worksheet, strWB As Workbook
Dim myPath As String, sFile As String

Application.ScreenUpdating = False
myPath = Application.ThisWorkbook.Path & "\"

sFile = Dir(myPath & "*.xlsx")
If sFile = "" Then
    MsgBox "No CAF_File found!!!", vbCritical
    Exit Sub
End If

Do While sFile <> ""
    Set strWB = Workbooks.Open(myPath & sFile)
        For Each ws In strWB.Worksheets
            ws.Unprotect "ABCD"
        Next
    strWB.Close True
sFile = Dir
Loop
Set strWB = Nothing

Application.ScreenUpdating = True
End Sub
 
I do not know password i want to Break that Password & save that file

Just some time ago i responded on the same type of query. Please be seated : Entire chandoo team is just coming at your doorstep to break the password. :DD:DD
 
I have Macro but that is 1 by 1 file & active sheet for work please tell me All files & all sheets how to run this macro
 
Sub Passwordunlock()

Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126

ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next


End Sub
 
I am trying with this it is work but every time get message click ok then pull next file can u please tell me how to avoid this

Sub unprotect()
Dim ws As Worksheet, strWB As Workbook
Dim myPath As String, sFile As String
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer


Application.ScreenUpdating = False
myPath = Application.ThisWorkbook.Path & "\"

sFile = Dir(myPath & "*.xlsx")
If sFile = "" Then
MsgBox "No CAF_File found!!!", vbCritical
Exit Sub
End If

Do While sFile <> ""
Set strWB = Workbooks.Open(myPath & sFile)
For Each ws In strWB.Worksheets
'ws.unprotect
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126

ws.unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)

Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
Next
strWB.Close True
sFile = Dir
Loop
Set strWB = Nothing

Application.ScreenUpdating = True
End Sub
 
Status
Not open for further replies.
Back
Top