Skip to content
本页内容

ProtectionMode (属性)

如果启用了用户界面专用保护,则为 True。要打开用户界面保护,请使用 Protect 方法,并将 UserInterfaceOnly 参数设置为 Truebool 类型,只读。

示例

python
#本示例显示活动工作表 ProtectionMode 属性的状态
def test():
    print(ActiveSheet.ProtectionMode)
python
#本示例判断工作簿中每一张工作表是否启用了用户界面专用保护
def test():
    for i in range(1, Sheets.Count):
        sheet = Application.Sheets.Item(i)
        if sheet.ProtectionMode:
            print(f"工作表 {sheet.Name} 启用了用户界面专用保护")
        else:
            print(f"工作表 {sheet.Name} 未启用了用户界面专用保护")