Remove forgotten password from protected Excel worksheet
I am Mr. Forgetful. What was this password again?
Anyway, if you do not know any better, use brute force!
Source Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
' @Author - Alexander Bolte' @ChangeDate - 2013-12-15' @Description - Removes the password from a protected worksheet using brute force.' Select a protected worksheet and start the sub.SubPasswordBreaker()DimiAsInteger,jAsInteger,kAsIntegerDimlAsInteger,mAsInteger,nAsIntegerDimi1AsInteger,i2AsInteger,i3AsIntegerDimi4AsInteger,i5AsInteger,i6AsIntegerDimtrgAsWorksheetOnErrorResumeNextSettrg=ActiveSheetFori=65To66:Forj=65To66:Fork=65To66Forl=65To66:Form=65To66:Fori1=65To66Fori2=65To66:Fori3=65To66:Fori4=65To66Fori5=65To66:Fori6=65To66:Forn=32To126trg.UnprotectChr(i)&Chr(j)&Chr(k)&_Chr(l)&Chr(m)&Chr(i1)&Chr(i2)&Chr(i3)&_Chr(i4)&Chr(i5)&Chr(i6)&Chr(n)Iftrg.ProtectContents=FalseThenMsgBox"One usable password is "&Chr(i)&Chr(j)&_Chr(k)&Chr(l)&Chr(m)&Chr(i1)&Chr(i2)&_Chr(i3)&Chr(i4)&Chr(i5)&Chr(i6)&Chr(n),vbInformation,";0)"ExitSubEndIfNext:Next:Next:Next:Next:NextNext:Next:Next:Next:Next:NextEndSub