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