主题
ProtectScenarios (属性)
如果工作表的方案处于保护状态,则该属性值为 True。bool 类型,只读。
示例
python
#本示例判断如果 sheet1 中的方案处于保护状态,则将显示消息框
def test():
if Worksheets.Item("Sheet1").ProtectScenarios:
print("Scenarios are protected on this worksheet.")
python
#本示例判断工作簿中每一张工作表的方案是否处于保护状态
def test():
for i in range(1, Sheets.Count):
sheet = Application.Sheets.Item(i)
if sheet.ProtectScenarios:
print(f"工作表 {sheet.Name} 方案处于保护状态")
else:
print(f"工作表 {sheet.Name} 方案未处于保护状态")