UserPermission.UserId property (Office)
Gets the email name of the user whose permissions on the active document are determined by the specified UserPermission object. Read-only.
Syntax
expression.UserId
expression A variable that represents a UserPermission object.
Remarks
The UserPermission object associates a set of permissions on the active document with a single user and an optional expiration date. The UserID property returns the name in email form of the user whose permissions are determined by the specified UserPermission object.
Example
The following example lists the users who have permissions on the active document.
Dim irmPermission As Office.Permission
Dim irmUserPerm As Office.UserPermission
Dim strUsers As String
Set irmPermission = ActiveWorkbook.Permission
If irmPermission.Enabled Then
For Each irmUserPerm In irmPermission
strUsers = strUsers & irmUserPerm.UserId & vbCrLf
Next
MsgBox strUsers, _
vbInformation + vbOKOnly, "IRM Information"
Else
MsgBox "Permissions are not enabled for this document.", _
vbInformation + vbOKOnly, "IRM Information"
End If
Set irmUserPerm = Nothing
Set irmPermission = Nothing
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.