Class UserAccess (Excel VBA)
The class UserAccess represents the user access for a protected range.
To use a UserAccess class variable it first needs to be instantiated, for example
Dim strName As String: strName = Dim ual As UserAccessList: Set ual = Dim usrac As UserAccess Set usrac = ual.Add(Name:=strName, AllowEdit:=True)
Here is an example of processing the UserAccess items in a collection.
Dim aer As AllowEditRange: Set aer = Dim usracUser As UserAccess For Each usracUser In aer.Users Next usracUser
Returns or sets a Boolean value that indicates if the user is allowed access to the specified range on a protected worksheet.
Deletes the object.
Returns or sets a String value that represents the name of the object.
Adds a user access list.
Returns a Long value that represents the number of objects in the collection.
Removes all users who have access to a protected range on a worksheet.
Sub UseDeleteAll() Dim wksSheet As Worksheet Set wksSheet = Application.ActiveSheet ' Remove all users with access to the first protected range. wksSheet.Protection.AllowEditRanges(1).Users.DeleteAll End Sub
Returns a single UserAccess object from the collection.
For more information about returning a single member of a collection, see Returning an object from a collection.
Syntax : expression.Item (Index)
Index: The name or index number of the object.