UserAccess 对象 (Excel)UserAccess object (Excel)

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

示例Example

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

一旦返回一个UserAccess对象,您可以确定是否特定区域在表中,允许访问使用**AllowEdit** 属性。Once a UserAccess object is returned, you can determine if access is allowed for a particular range in an worksheet, using the AllowEdit property. 下面的示例在受保护的工作表上添加可编辑区域,并通知用户该区域的标题。The following example adds a range that can be edited on a protected worksheet and notifies the user 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

Excel 对象模型引用Excel Object Model Reference

支持和反馈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.