跳到主要內容

如何在Excel中恢復丟失的工作表保護密碼?

我們總是設置密碼以保護某些重要的工作表不被其他工作表破壞或修改。 但是,如果您忘記了密碼,該怎麼辦? 幸運的是,Excel支持一些VBA代碼來恢復丟失的工作表保護密碼。 您可以這樣處理此問題:

使用VBA代碼在Excel中恢復丟失的工作表保護密碼
有關保護工作表的更多教程...


使用VBA代碼在Excel中恢復丟失的工作表保護密碼

以下VBA代碼可以幫助您快速取消工作表中的原始密碼。

1。 打開您以前受保護的工作表。

2。 按住 ALT + F11 鍵,然後打開 Microsoft Visual Basic for Applications窗口.

3。 點擊 插入 > 模塊,然後將以下代碼粘貼到 模塊窗口.

VBA代碼:恢復丟失的工作表保護密碼

Sub PasswordRecovery()
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "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)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub

4。 然後點擊 F5 鍵運行此代碼,然後會彈出一個提示框,單擊 OK 將其關閉,您的受保護工作表密碼將立即被取消。

筆記:

1.使用此代碼,您一次只能恢復一個工作表保護密碼,如果有多個受保護的工作表,則需要一個一個地應用此代碼。
2.上面的代碼來自 http://excelzoom.com/2009/08/how-to-recover-lost-excel-passwords/.


使用Excel中的密碼輕鬆地同時保護多個工作表:

保護工作表 的效用 Excel的Kutools 可以幫助您使用相同的密碼批量保護多個工作表。 它還提供了實用程序來同時取消保護這些工作表。 立即下載Kutools for Excel的全功能30天免費試用版!


相關文章

如何在Excel中一次保護多個工作表?

如何在Excel中一次取消保護多個工作表?

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (99)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
What is the Macro name?
This comment was minimized by the moderator on the site
Even using this code below, I continue to receive this message: (When I running that code on Excel 365, I got this message error:
Runtime '1004'
The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.
Please if you can help me on this.
thank you very much)
Sub PasswordRecovery()
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "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)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub
This comment was minimized by the moderator on the site
Hello, Jose,
If the VBA code can't work well in Office 365, maybe the following article can help you, there are two methods in that article, please check it:
https://www.extendoffice.com/documents/excel/7179-excel-unprotect-all-sheets-without-password.html
Thank you!
This comment was minimized by the moderator on the site
When I running that code on Excel 365, I got this message error:
Run-time '1004'
The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.
Please if can help me on this.
thank you very much
This comment was minimized by the moderator on the site
The tip to recover my password says to open the Excel document. Without the password I cant open it, so how does this work?
This comment was minimized by the moderator on the site
Il existe de nombreux programmes pour récupérer le mot de passe des fichiers Excel. J'utilise Manyprog Excel Password Recovery. C'est rapide et facile à utiliser. https://fr.manyprog.com/excel-password-recovery.php
This comment was minimized by the moderator on the site
Hi. I've got Microsoft 365 . Does it work too ?I tried, but for now couldn't open my xlsx files..
This comment was minimized by the moderator on the site
Thank you! After saving it as an Excel 91-2003 (.xls) doc, I was able to use this to unlock all the worksheets within the workbook. Literally saved me so much time.
This comment was minimized by the moderator on the site
This does not appear to work. It only generates passwords with As, Bs and something else at the end. What am I missing?
This comment was minimized by the moderator on the site
This algorithm doesn't work. Only generates PWs with As, Bs and something different at the end. What am I missing?
This comment was minimized by the moderator on the site
Hay muchos programas para recuperar la contraseña de los archivos de Excel. Estoy usando Manyprog Excel Password Recovery. Es rápido y fácil de usar. https://es.manyprog.com/excel-password-recovery.php
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations