View difference between Paste ID: axSyxGrU and yeuXgYjx
SHOW: | | - or go back to the newest paste.
1
Sub Deproteger()
2
Dim A As Byte, B As Byte, C As Byte, D As Byte, E As Byte
3
Dim F As Byte, G As Byte, H As Byte, I As Byte, J As Byte
4
Dim K As Byte, L As Byte, M As Byte, N As Byte, O As Byte
5
Dim Reponse As Byte, Temps As Variant
6
Dim Cible As Object, Passe As String
7
Reponse = MsgBox("Do you want to unprotect the current workbook ?" & vbCrLf & _
8
"If you answer no, it's the current worksheet that will be unprotected. ", _
9
vbYesNoCancel, "Déprotectionnateur")
10
On Error Resume Next
11
Select Case Reponse
12
Case vbYes
13
Set Cible = ActiveWorkbook
14
If Not (Cible.ProtectStructure Or Cible.ProtectWindows) Then
15
MsgBox "The current workbook isn't protected. " & vbCrLf & _
16
vbCrLf & "Idiot !", vbOKOnly, "Déprotectionnateur"
17
Exit Sub
18
End If
19
Err.Clear
20
Cible.Unprotect vbNullString
21
If Err = 0 Then
22
MsgBox "The current workbook has been unprotected. " _
23
& vbCrLf & "There wasn't any password!", _
24
vbOKOnly, "Déprotectionnateur"
25
Exit Sub
26
End If
27
Case vbNo
28
Set Cible = ActiveSheet
29
If Not (Cible.ProtectContents Or Cible.ProtectDrawingObjects Or _
30
Cible.ProtectScenarios) Then
31
MsgBox "The current worksheet isn't protected! " & vbCrLf & _
32
vbCrLf & "Dummy!", vbOKOnly, "Déprotectionnateur"
33
Exit Sub
34
End If
35
Err.Clear
36
Cible.Unprotect vbNullString
37
If Err = 0 Then
38
MsgBox "The current worksheet has been unprotected. " _
39
& vbCrLf & "There wasn't any password!", _
40
vbOKOnly, "Déprotectionnateur"
41
Exit Sub
42
End If
43
Case Else
44
MsgBox String(14, " ") & "CyberHacktivist says byebye!", vbOKOnly, "Déprotectionnateur"
45
Exit Sub
46
End Select
47
Temps = Timer
48
For A = 48 To 49
49
For B = 48 To 49
50
For C = 48 To 49
51
For D = 48 To 49
52
For E = 48 To 49
53
For F = 48 To 49
54
For G = 48 To 49
55
For H = 48 To 49
56
For I = 48 To 49
57
For J = 48 To 49
58
For K = 48 To 49
59
For L = 48 To 49
60
For M = 48 To 49
61
For N = 48 To 49
62
For O = 48 To 49
63
Passe = Chr(A) & Chr(B) & Chr(C) & Chr(D) & Chr(E) & _
64
Chr(F) & Chr(G) & Chr(H) & Chr(I) & Chr(J) & _
65
Chr(K) & Chr(L) & Chr(M) & Chr(N) & Chr(O)
66
Err.Clear
67
Cible.Unprotect Passe
68
If Err = 0 Then
69
MsgBox "The protection was deleted in " & _
70
Timer - Temps & " secondes. " & vbCrLf & _
71
"The equivalent password found was :" & _
72
vbCrLf & vbCrLf & String(28, " ") & Passe, _
73
vbOKOnly, "Déprotectionnateur"
74
Exit Sub
75
End If
76
Next
77
Next
78
Next
79
Next
80
Next
81
Next
82
Next
83
Next
84
Next
85
Next
86
Next
87
Next
88
Next
89
Next
90
Next
91
MsgBox "The password could not be found." & vbCrLf & vbCrLf & _
92
"This isn't normal, try again", vbOKOnly, "Déprotectionnateur"
93
End Sub