If you are removing (not retrieving) a worksheet password, the following code can be used:
In a common Module we paste the following code that removes the code from the activated sheet: Code: 'CAUTION!! Recommended only for proprietary Excel sheets!
Option Explicit Sub GetPass() Const a = 65, b = 66, c = 32, d = 126 Dim i#, j#, k#, l#, m#, n#, o#, p#, q#, r#, s#, t# With ActiveSheet If .ProtectContents Then On Error Resume Next For i = a To b For j = a To b For k = a To b For l = a To b For m = a To b For n = a To b For o = a To b For p = a To b For q = a To b For r = a To b For s = a To b For t = c To d .Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & _ Chr(n) & Chr(o) & Chr(p) & Chr(q) & Chr(r) & Chr(s) & Chr(t) Next t Next s Next r Next q Next p Next o Next n Next m Next l Next k Next j Next i MsgBox "Finished" End If End With End Sub
The time it will take depends to a large extent on the power of the computer.
Third-party information disclaimer
The third-party products that this article discusses are manufactured by companies that are independent of me. I makes no warranty, implied or otherwise, about the performance or reliability of these products