excel - 通过宏保护具有多个工作表的整个工作簿
问题描述
我想保护具有多张工作表的整个工作簿。还需要对所有纸张进行保护。有没有办法做到这一点?
解决方案
你可以从这里开始:
Sub protect()
Dim s As String
Dim ws As Worksheet
s = InputBox("Enter Password", "Protection", "")
For Each ws In ThisWorkbook.Worksheets
ws.protect s
Next ws
ThisWorkbook.protect s
End Sub
Sub unprotect()
Dim s As String
Dim ws As Worksheet
s = InputBox("Enter Password", "Protection", "")
For Each ws In ThisWorkbook.Worksheets
ws.unprotect s
Next ws
ThisWorkbook.unprotect s
End Sub
更改以与其他工作簿和/或密码一起使用。
推荐阅读
- javascript - 如何使我的分屏响应?
- apache-spark - 如何使用 saveAsNewAPIHadoopFile spark scala 将文件保存在同一目录中
- ngx-graph - 如何添加 ngx-graph 自定义布局
- html - 如何在同一行对齐材质图标和标题文本?
- angular - Angular 7:NullInjectorError:MatSnackBarConfig 没有提供者
- jpa - 如何将 PersitenceProvider 实现到 Tapestry 项目的运行时环境中?
- delphi - 是否可以在不复制像素的情况下将 TBitmap32 转换为 TBitmap?
- json - 如何将参数传递给 Azure Logic Apps Liquid Connector 以进行 JSON-JSON 转换?
- excel - Excel:仅对具有特定标签的值求和
- angular - 错误:StaticInjectorError(DynamicTestModule)[FilterOptionsComponent -> Environment]: