Table of contents

UserPermission.Permission 属性 (办公室)UserPermission.Permission Property (Office)

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

返回或设置一个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.


表达式权限expression. Permission

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


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

UserPermission对象将一组在活动文档的权限与单个用户和可选的到期日期相关联。权限属性返回由指定UserPermission对象的用户权限的组。尽管某些通过用户界面 (如msoPermissionPrint ) 授予的权限适用于所有用户,可以使用UserPermission对象到期日期分别为每个用户分配它们。The UserPermission object associates a set of permissions on the active document with a single user and an optional expiration date. The Permission property returns the set of user permissions determined by the specified UserPermission object. 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选项对应于用户界面中的更改选项。MsoPermissionChange选项表示的msoPermissionView和 + msoPermissionEdit + msoPermissionSave + msoPermissionExtract ,并允许用户查看、 编辑、 复制和保存,但无法打印文档。The msoPermissionChange option corresponds to the Change option in the user interface. 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选项对应于用户界面中的以编程方式访问内容选项,并允许用户通过其对象模型以编程方式访问该文档。没有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. Users without msoPermissionObjectModel cannot use the object model to determine their own rights, since programmatic access is disabled.


下面的示例使用按位And运算符使用权限属性和一个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

其他资源Other resources

UserPermission 对象成员UserPermission Object Members

© 2018 Microsoft