Skip to content
本页内容

ProtectionMode (属性)

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

示例

python
#此示例显示活动工作表 ProtectionMode 属性的状态
def test():
    print(Application.ActiveSheet.ProtectionMode)
python
#本示例保护图表工作表 Chart1,然后判断是否启用用户界面并通知用户
def test():
    chart = Application.Charts.Item("Chart1")
    chart.Protect(None, True, False, True, True)
    if chart.ProtectionMode == False:
        print("工作表的用户界面未受保护")
    else:
        print("工作表的用户界面受保护")