Skip to content
本页内容

AllowEditRanges (属性)

返回 AllowEditRanges 对象。

示例

python
#在本示例中,ET 允许用户编辑活动工作表上的区域 A1:A4,并将指定区域的标题和地址通知用户
def test():
    sheet = Application.ActiveSheet

    # Unprotect worksheet.
    sheet.Unprotect()

    # Establish a range that can allow edits on the protected worksheet.
    sheet.Protection.AllowEditRanges.Add("Classified", Range("A1:A4"), "123")

    # Notify the user the title and address of the range.
    allowEditRange = sheet.Protection.AllowEditRanges.Item(1)

    print(f"Title of range: {allowEditRange.Title}")
    print(f"Address of range: {allowEditRange.Range.Address()}")
python
#本示例显示第二张工作表上 AllowEditRange 对象的数量
def test():
    print(Worksheets.Item(2).Protection.AllowEditRanges.Count)