Add users : Office Permmison « Application « VBA / Excel / Access / Word






Add users

 

Sub AddUsers()
    Dim myPermission As Office.Permission, usr As Office.UserPermission
    Set myPermission = ThisWorkbook.Permission
    myPermission.RemoveAll
    myPermission.Add "someone@hotmail.com", MsoPermission.msoPermissionView
    Set usr = myPermission.Add("ExcelDemo@hotmail.com", MsoPermission.msoPermissionView)
    usr.Permission = MsoPermission.msoPermissionPrint Or MsoPermission.msoPermissionExtract
    Set usr = myPermission("ExcelDemo@hotmail.com")
    usr.ExpirationDate = Date + 1
End Sub

 








Related examples in the same category

1.Enable permission
2.The Permission of current workbook
3.Show User Permissions
4.Remove Permissions
5.Show Permissions
6.Set office Permission