Name
permission.Add(UserId, [Permission], [ExpirationDate])
Synopsis
Adds permission for a user to access a workbook. Returns a UserPermission object.
|
Argument |
Description |
|---|---|
|
|
The identity of the user for which to grant permissions |
|
|
One or more of the |
|
|
The date after which the user no longer has permissions |
The Permission argument can be one or more of the following constants. Join multiple permissions with the Or operator:
msoPermissionChange
msoPermissionEdit
msoPermissionExtract
msoPermissionFullControl
msoPermissionObjModel
msoPermissionPrint
msoPermissionRead
msoPermissionSave
msoPermissionViewFor example, the following code grants a Passport account permission to view and copy a workbook:
Set irm = ThisWorkbook.Permission
Set usr = irm.Add("ExcelDemo@hotmail.com", MsoPermission.msoPermissionView _
Or MsoPermission.msoPermissionExtract)Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access