Worksheet.Protection 属性 (Excel)
返回一个 Protection 对象,该对象代表工作表的保护选项。
语法
表达式。保护
表达 一个代表 Worksheet 对象的变量。
示例
本示例对活动工作表进行保护,并判断是否能在受保护的工作表中插入列,然后将此状态通知用户。
Sub CheckProtection()
ActiveSheet.Protect
' Check the ability to insert columns on a protected sheet.
' Notify the user of this status.
If ActiveSheet.Protection.AllowInsertingColumns = True Then
MsgBox "The insertion of columns is allowed on this protected worksheet."
Else
MsgBox "The insertion of columns is not allowed on this protected worksheet."
End If
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈