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 usrac as UserAccess
Set usrac = ActiveSheet.Protection.AllowEditRanges(1).Users(Index:=1)

For Each

Here is an example of processing the UserAccess items in a collection.


Dim usracUser As UserAccess
For Each usracUser In ActiveSheet.Protection.AllowEditRanges(1).Users
	
Next usracUser

AllowEdit

Returns or sets a Boolean value that indicates if the user is allowed access to the specified range on a protected worksheet.


ActiveSheet.Protection.AllowEditRanges(1).Users(1).AllowEdit = True

Delete

Deletes the object.


ActiveSheet.Protection.AllowEditRanges(1).Users(1).Delete

Name

Returns or sets a String value that represents the name of the object.


Dim strName As String
strName = ActiveSheet.Protection.AllowEditRanges(1).Users(1).Name