Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Deproteger()
- Dim A As Byte, B As Byte, C As Byte, D As Byte, E As Byte
- Dim F As Byte, G As Byte, H As Byte, I As Byte, J As Byte
- Dim K As Byte, L As Byte, M As Byte, N As Byte, O As Byte
- Dim Reponse As Byte, Temps As Variant
- Dim Cible As Object, Passe As String
- Reponse = MsgBox("Do you want to unprotect the current workbook ?" & vbCrLf & _
- "If you answer no, it's the current worksheet that will be unprotected. ", _
- vbYesNoCancel, "Déprotectionnateur")
- On Error Resume Next
- Select Case Reponse
- Case vbYes
- Set Cible = ActiveWorkbook
- If Not (Cible.ProtectStructure Or Cible.ProtectWindows) Then
- MsgBox "The current workbook isn't protected. " & vbCrLf & _
- vbCrLf & "Idiot !", vbOKOnly, "Déprotectionnateur"
- Exit Sub
- End If
- Err.Clear
- Cible.Unprotect vbNullString
- If Err = 0 Then
- MsgBox "The current workbook has been unprotected. " _
- & vbCrLf & "There wasn't any password!", _
- vbOKOnly, "Déprotectionnateur"
- Exit Sub
- End If
- Case vbNo
- Set Cible = ActiveSheet
- If Not (Cible.ProtectContents Or Cible.ProtectDrawingObjects Or _
- Cible.ProtectScenarios) Then
- MsgBox "The current worksheet isn't protected! " & vbCrLf & _
- vbCrLf & "Dummy!", vbOKOnly, "Déprotectionnateur"
- Exit Sub
- End If
- Err.Clear
- Cible.Unprotect vbNullString
- If Err = 0 Then
- MsgBox "The current worksheet has been unprotected. " _
- & vbCrLf & "There wasn't any password!", _
- vbOKOnly, "Déprotectionnateur"
- Exit Sub
- End If
- Case Else
- MsgBox String(14, " ") & "CyberHacktivist says byebye!", vbOKOnly, "Déprotectionnateur"
- Exit Sub
- End Select
- Temps = Timer
- For A = 48 To 49
- For B = 48 To 49
- For C = 48 To 49
- For D = 48 To 49
- For E = 48 To 49
- For F = 48 To 49
- For G = 48 To 49
- For H = 48 To 49
- For I = 48 To 49
- For J = 48 To 49
- For K = 48 To 49
- For L = 48 To 49
- For M = 48 To 49
- For N = 48 To 49
- For O = 48 To 49
- Passe = Chr(A) & Chr(B) & Chr(C) & Chr(D) & Chr(E) & _
- Chr(F) & Chr(G) & Chr(H) & Chr(I) & Chr(J) & _
- Chr(K) & Chr(L) & Chr(M) & Chr(N) & Chr(O)
- Err.Clear
- Cible.Unprotect Passe
- If Err = 0 Then
- MsgBox "The protection was deleted in " & _
- Timer - Temps & " secondes. " & vbCrLf & _
- "The equivalent password found was :" & _
- vbCrLf & vbCrLf & String(28, " ") & Passe, _
- vbOKOnly, "Déprotectionnateur"
- Exit Sub
- End If
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- Next
- MsgBox "The password could not be found." & vbCrLf & vbCrLf & _
- "This isn't normal, try again", vbOKOnly, "Déprotectionnateur"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement