Skip to content
本页内容

ProtectDrawingObjects (属性)

如果形状是受保护的,则为 True。要打开形状保护,请使用 Protect 方法,并将 DrawingObjects 参数设置为 Truebool 类型,只读。

示例

python
#本示例判断如果工作表 Sheet1 中的形状处于保护状态,则显示一个消息框
def test():
    if Worksheets.Item("Sheet1").ProtectDrawingObjects:
        print("The shapes on Sheet1 are protected.")
python
#本示例判断工作簿中每一张工作表的形状是否处于保护状态
def test():
    for i in range(1, Application.Sheets.Count):
        sheet = Application.Sheets.Item(i)
        if sheet.ProtectDrawingObjects:
            print(f"工作表 {sheet.Name} 中的形状处于保护状态")
        else:
            print(f"工作表 {sheet.Name} 中的形状未处于保护状态")