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 msoPermissionView
For 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)
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.