UserAccess 对象 (Excel)UserAccess object (Excel)

代表对受保护区域的用户访问。Represents the user access for a protected range.


使用**Add** 方法或UserAccessList集合的**Item** 属性可返回一个UserAccess对象。Use the Add method or the Item property of the UserAccessList collection to return a UserAccess object.

返回UserAccess对象后, 您可以使用AllowEdit属性确定是否允许对工作表上的特定区域进行访问。After a UserAccess object is returned, you can determine if access is allowed for a particular range on a worksheet by using the AllowEdit property.

下面的示例添加可在受保护的工作表上编辑的区域, 并将该范围的标题通知给用户。The following example adds a range that can be edited on a protected worksheet and notifies the user of the title of that range.

Sub UseAllowEditRanges() 
 Dim wksSheet As Worksheet 
 Set 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. 
 MsgBox wksSheet.Protection.AllowEditRanges(1).Title 
End Sub



另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.