主题
AllowEditRanges (对象)
所有 AllowEditRange对象的集合,这些对象代表受保护工作表上的可编辑单元格。
说明
使用 Protection 对象的 AllowEditRanges 属性可返回 AllowEditRanges 集合。
返回 AllowEditRanges 集合后,可以使用 Add 方法添加可在受保护的工作表上编辑的区域。
示例
python
#在本示例中,ET 允许用户编辑活动工作表上的区域 A1:A4,并将指定区域的标题和地址通知用户
def test():
sheet = Application.ActiveSheet
# Unprotect worksheet.
sheet.Unprotect()
wksPassword = "Enter password for the worksheet"
# Establish a range that can allow edits on the protected worksheet.
sheet.Protection.AllowEditRanges.Add("Classified", Range("A1:A4"), wksPassword)
# Notify the user the title and address of the range.
allowEditRange = sheet.Protection.AllowEditRanges.Item(1)
print("Title of range:", allowEditRange.Title)
print("Address of range:", allowEditRange.Range.Address())
python
#本示例显示第一张工作表上是否存在可编辑单元格
def test():
print(Worksheets.Item(1).Protection.AllowEditRanges.Count > 0)