返回一个 Protection 对象,该对象代表工作表的保护选项。
expression.Protection
expression 必需。该表达式返回一个 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