Skip to content
本页内容

UserAccess (对象)

代表对受保护区域的用户访问。

说明

使用 UserAccessList 集合的 Add方法或 Item 属性可返回一个 UserAccess 对象。

一旦返回了 UserAccess 对象,您就可以使用 AllowEdit属性来确定是否允许访问工作表中某个特定区域。下例添加一个在受保护的工作表上可编辑的区域,并通知用户该区域的标题。

python
def test():
    wksSheet = Application.ActiveSheet
    
    #Add a range that can be edited on the protected worksheet.
    wksSheet.Protection.AllowEditRanges.Add("Test", Range("A1"))
    
    #Notify the user the title of the range that can be edited.
    print(wksSheet.Protection.AllowEditRanges.Item(1).Title)