Share via


UserAccess Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

UserAccessList
Aa168091.parchild(en-us,office.10).gifUserAccess

Represents the user access for a protected range.

Using the UserAccess object

Use the Add method or the Item property of the UserAccessList collection to return a UserAccess object.

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