UserPermission.Permission 属性 (Office)UserPermission.Permission Property (Office)

返回或设置一个MsoPermission常量作为一个Long值,代表分配给与指定的UserPermission对象关联的用户的活动文档的权限。Returns or sets a MsoPermission constant as a Long value representing the permissions on the active document assigned to the user associated with the specified UserPermission object. 为可读/写属性。Read/write.


expressionexpression. Permission

_表达式_一个代表UserPermission对象的变量。expression A variable that represents a UserPermission object.


Permission属性可以是一个或MsoPermission常量的组合。The Permission property can be one or a combination of MsoPermission constants.

UserPermission对象将与单个用户和可选的到期日期关联一的组活动文档的权限。The UserPermission object associates a set of permissions on the active document with a single user and an optional expiration date. Permission属性返回的一组用户权限由指定的UserPermission对象。The Permission property returns the set of user permissions determined by the specified UserPermission object. 将某些通过用户界面(如 msoPermissionPrint)授予的权限应用于所有用户时,可以使用 UserPermission 对象分别为每个用户分配这些权限并指定它们的到期日期。While some permissions granted through the user interface (such as msoPermissionPrint) apply to all users, you can use the UserPermission object to assign them on a per-user basis with per-user expiration dates.

  • MsoPermissionViewmsoPermissionRead选项对应于在用户界面中的读取选项。The msoPermissionView or msoPermissionRead option corresponds to the Read option in the user interface.

  • MsoPermissionExtract选项与用户界面中的允许用户具有读取访问权限,以将内容复制选项。The msoPermissionExtract option corresponds to the Allow users with read access to copy content option in the user interface.

  • MsoPermissionChange选项对应于用户界面中的更改选项。The msoPermissionChange option corresponds to the Change option in the user interface. MsoPermissionChange选项表示的总和的msoPermissionView + msoPermissionEdit + msoPermissionSave + msoPermissionExtract并允许用户查看、 编辑、 复制和保存,但不是能打印文档。The msoPermissionChange option represents the sum of msoPermissionView + msoPermissionEdit + msoPermissionSave + msoPermissionExtract and allows users to view, edit, copy, and save, but not print the document.

  • MsoPermissionPrint选项对应于在用户界面中打印内容选项。The msoPermissionPrint option corresponds to the Print content option in the user interface.

  • MsoPermissionObjectModel选项对应于用户界面中的以编程方式访问内容选项,并允许用户通过其对象模型以编程方式访问文档。The msoPermissionObjectModel option corresponds to the Access content programmatically option in the user interface and allows users to access the document programmatically through its object model. 没有msoPermissionObjectModel用户不能使用对象模型来确定他们自己的权限,因为禁用编程访问。Users without msoPermissionObjectModel cannot use the object model to determine their own rights, since programmatic access is disabled.


下面的示例使用按位And运算符、 Permission属性和一个msoPermission常量一起使用来确定第二个用户是否有保存活动文档的权限。The following example uses the bitwise And operator with the Permission property and an msoPermission constant to determine whether the second user has permission to save the active document.

 Dim irmPermission As Office.Permission 
 Dim irmUserPerm As Office.UserPermission 
 Set irmPermission = ActiveWorkbook.Permission 
 Set irmUserPerm = irmPermission.Item(2) 
 If irmUserPerm.Permission And Office.msoPermissionSave Then 
 MsgBox "User " & irmUserPerm.UserId & _ 
 " has permission to save this document.", _ 
 vbInformation + vbOKOnly, "IRM Information" 
 MsgBox "User " & irmUserPerm.UserId & _ 
 " does NOT have permission to save this document.", _ 
 vbInformation + vbOKOnly, "IRM Information" 
 End If 
 Set irmUserPerm = Nothing 
 Set irmPermission = Nothing 

另请参阅See also

UserPermission 对象UserPermission Object

UserPermission 对象成员UserPermission Object Members