Table of contents
TOC
Collapse the table of content
Expand the table of content

Permission.Add Method (Office)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Creates a set of permissions on the active document for the specified user. Returns a UserPermission object.

Syntax

expression. Add( UserID, Permission, ExpirationDate )

expression Required. A variable that represents a Permission object.

Parameters

NameRequired/OptionalData TypeDescription
UserIDRequiredStringThe e-mail address (in the format user@domain.com) of the user to whom permissions on the active document are being granted.
PermissionOptionalmsoPermissionThe permissions on the active document that are being granted to the specified user.
ExpirationDateOptionalDateThe expiration date for the permissions that are being granted. Note: this parameter is not used and will be ignored.

Example

The following example assigns a combination of read and edit permissions on the current document to a user and specifies an expiration date for these document permissions.

 Dim objUserPerm As Office.UserPermission 
 Set objUserPerm = ActiveWorkbook.Permission.Add( _ 
 "user@domain.com", _ 
 msoPermissionRead + msoPermissionEdit, #12/31/2005#) 
 MsgBox "Permissions added for " & _ 
 objUserPerm.UserId, _ 
 vbInformation + vbOKOnly, _ 
 "Permissions Added" 
 Set objUserPerm = Nothing 

See also

Concepts

Permission Object

Other resources

Permission Object Members

© 2018 Microsoft