You are on page 1of 2

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

You might also like