How to unprotect the excel sheet if forgot the password

New Contributor

Hi team need support to unprotect my sheet which is password protected and forgot the password

 

191 Replies

@VladValentineCC 

Don't forget you can use this procedure to open a locked worksheet (possibly),

but you cannot open a workbook under any circumstances with this procedure.

 

Caution: If you create a password for a workbook, make a note of the password and keep it in a safe place. If you lose the password, you cannot open or access the password-protected workbook.

@NikolinoDE
I have tried the methods it does not help.

Can you please help?
@NikolinoDE
I have tried the methods to open a password protected workbook but could not

Can you please help?

I was trying to access a password protected spreadsheet. 
I read through various replies here and came up with a very simple solution that worked for me.
- Save the protected Excel file as 97-2003
- Open in Google Drive
- Sheet is unprotected

the spreadsheet in question can be found here: 

Search: Private sector rents. Information on monthly rents paid in the private rented sector in Wales.Data Provider: Welsh Government Private sector rents by local authority, 1 January to 31 December 2019

@nickg2215 

On your fist step, how to save the protected excel file to version 97-2003?  I can't open the protected excel, it is blank screen, only a box that I need to enter a password.  Using rename function?

@BrockT 

Removed the underscore and extra spaces between the next line

 

.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)

Remove the underscore and spaces

.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)

@NikolinoDE 

 

Hello I did some modifications ( getting log file) in hope that the password will be retrieved but alas it ain't working. Please have a look at it if I'm missing something 

 

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#
    Dim logPath As String
    logPath = "C:\logs\password_attempts.txt"
    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
                                                            Open logPath For Append As #1
                                                            Print #1, Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr(n) & Chr(o) & Chr(p) & Chr(q) & Chr(r) & Chr(s) & Chr(t)
                                                            Close #1
                                                            .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 lines that say:
.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)

...need to be joined together into one by deleting _ and all the spaces. I think they've just been split so that the code fits on the screen. So it/they need to read:
.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)

It didn't work for me until I did this - then it was so quick...

@naylorpd 

 

I know that, but my issue is that the password for unlocking is not getting shown in log file 

@NikolinoDE  I have ran the macro, but when I open the new file it is blank. Is it possible since my file of from 2017 there is a problem with my excel version? 

@NikolinoDE 

Please can you help me how to unprotect my excel spreadsheet? I forgot the password. I tried with the codes you suggested. But it couldn't perform. Shall I send you the spreadsheet and will you unprotect it please?