Skip to content
本页内容

AllowFormattingCells (属性)

如果允许对受保护的工作表上的单元格进行格式设置,则返回 Truebool 类型,只读。

说明

可以使用 Protect 方法参数设置 AllowFormattingCells 属性。

使用该属性可禁用“保护”选项卡,从而允许用户更改所有格式,但不能取消对区域的锁定或隐藏。

示例

python
#本示例允许用户对受保护的工作表上的单元格进行格式设置,并通知用户
def test():
    Application.ActiveSheet.Unprotect()
    # Allow cells to be formatted on a protected worksheet.
    if Application.ActiveSheet.Protection.AllowFormattingCells == False:
        Application.ActiveSheet.Protect(None, None, None, None, None, True)

    print("Cells can be formatted on this protected worksheet.")
python
#本示例显示是否允许对受保护的工作表上的单元格进行格式设置
def test():
    print(Worksheets.Item(1).Protection.AllowFormattingCells)