Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
Name | Required/Optional | Data type | Description |
---|---|---|---|
UserID | Required | String | The email address (in the format [email protected]) of the user to whom permissions on the active document are being granted. |
Permission | Optional | MsoPermission | The permissions on the active document that are being granted to the specified user. |
ExpirationDate | Optional | Date | The 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( _
"[email protected]", _
msoPermissionRead + msoPermissionEdit, #12/31/2005#)
MsgBox "Permissions added for " & _
objUserPerm.UserId, _
vbInformation + vbOKOnly, _
"Permissions Added"
Set objUserPerm = 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.