excel取消工作表保护_取消保护所有Excel工作表

excel取消工作表保护

When I'm working on an Excel file for a client, it's nice to have a quick way to unprotect all the worksheets, so I can make changes. It's easy to unprotect the sheets with a macro, like this one.

当我为客户端处理Excel文件时,很高兴有一种快速的方法来取消保护所有工作表,因此我可以进行更改。 像这样一个宏很容易取消保护工作表。

Sub UnprotectAllSheets()
Dim ws As Worksheet
 For Each ws In ThisWorkbook.Worksheets
   ws.Unprotect Password:="MyPassword"
 Next ws
End Sub

It's even easier to run that code to unprotect the sheets, if I add a shortcut for the macro, like Ctrl + Shift + U

如果我为宏添加快捷方式(例如Ctrl + Shift + U),则运行该代码以保护工作表更加容易。

UnprotectAllSheets01

However, I don't want to make it too easy to unprotect the sheets, or the users might do it accidentally. (I'm not going to worry about the few people who are determined to unprotect the sheets – that's a different problem!)

但是,我不想太容易取消保护床单,否则用户可能会意外地这样做。 (我不会为确定要保护床单的少数人担心,这是一个不同的问题!)

在取消保护宏中询问密码 (Ask for Password in the Unprotect Macro)

To help prevent users from accidentally running the macro, I add a few lines to the macro, to prompt for a password. When the macro starts, it prompts you for a password. If you enter the correct password, the sheets are unprotected.

为了防止用户意外运行宏,我在宏中添加了几行以提示输入密码。 宏启动时,会提示您输入密码。 如果输入正确的密码,则表未受到保护。

Sub UnprotectAllSheets()
Dim ws As Worksheet
Dim strPwd As String
Dim strCheck As String
strCheck = "MyPassword"
strPwd = InputBox("Enter Password", "Password", "Enter Password")
If strPwd = strCheck Then
  For Each ws In ThisWorkbook.Worksheets
    ws.Unprotect Password:=strPwd
  Next ws
Else
  MsgBox "Incorrect Password"
End If
End Sub

保护VBA代码 (Protect the VBA Code)

In the UnprotectAllSheets macro, the password, "MyPassword", is shown. Anyone who peeks at the code could easily see that password, and use it to unprotect the sheets.

在UnprotectAllSheets宏中,显示密码“ MyPassword”。 偷看该代码的任何人都可以轻松地看到该密码,并用它来保护工作表。

To help keep the password hidden, you can protect the VBA Project. In the Visual Basic Editor, click the Tools menu, and click VBAProject properties. (If you have named your project, you'll see its name, instead of VBAProject.)

为了帮助隐藏密码,您可以保护VBA项目。 在Visual Basic编辑器中,单击“工具”菜单,然后单击“ VBAProject属性”。 (如果已命名项目,则将看到其名称,而不是VBAProject。)

VBAProtect01

On the Protection tab,

在保护选项卡上,

  1. add a check mark to Lock Project for Viewing,

    在“锁定项目以供查看”中添加复选标记,
  2. enter and confirm a password,

    输入并确认密码,
  3. then click OK.

    然后单击确定。
VBAProtect02

And remember what the password is, so you'll be able to open the project later! _____________

记住密码是什么,以便以后可以打开项目! ______________

翻译自: https://contexturesblog.com/archives/2011/08/24/unprotect-all-excel-sheets/

excel取消工作表保护

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
取消Excel工作保护,你可以按照以下步骤进行操作: 1. 如果你知道工作保护的密码,可以通过以下方法取消保护: - 在Excel的工具栏中找到【审阅】选项卡,然后点击【撤销工作保护】按钮。 - 在弹出的提示框中输入原先设置的密码,然后点击【确定】。 2. 如果你忘记了设置的保护密码或者不知道密码,你可以借助其他工具来取消工作保护。例如使用百事牛的Excel工具: - 下载并打开百事牛Excel密码恢复工具。 - 在工具中选择【解除限制】模块,不需要输入密码,将Excel文件添加到工具中。 - 点击【开始】按钮,工具会自动取消Excel文件的保护限制。 请注意,在完成取消工作保护的操作后,建议静等10秒钟再关闭Excel,以确保保存完成。 如果你想要保护Excel工作薄,可以按照以下步骤进行操作: 1. 在Excel的工具栏中找到【审阅】选项卡,然后点击【保护工作簿】按钮。 2. 输入一个密码,并再次确认密码,然后点击【确定】按钮。 3. 这样就启用了工作簿的保护功能,保护工作簿的整个结构,包括不能添加或删除工作,以及无法取消显示已隐藏的工作。 如果你想要取消Excel工作簿的保护,可以按照以下步骤进行操作: 1. 在Excel的工具栏中找到【审阅】选项卡,然后点击【保护工作簿】按钮。 2. 输入之前设置的密码,然后点击【确定】按钮。 这样就取消工作簿的保护,相关功能将恢复正常。<span class="em">1</span><span class="em">2</span><span class="em">3</span>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值