Permission.ApplyPolicy method (Office)

Applies the specified permission policy to the active document.

Syntax

expression.ApplyPolicy (FileName)

expression A variable that represents a Permission object.

Parameters

Name Required/Optional Data type Description
FileName Required String The path and file name of the permission policy template file.

Remarks

Microsoft Office Information Rights Management supports the use of administrative permission policies that list users and groups and their document permissions. The ApplyPolicy method applies a permission policy to the active document.

Example

The following example enables permissions on the active document and applies an administrative permission policy.

 Dim irmPermission As Office.Permission 
 Set irmPermission = ActiveWorkbook.Permission 
 Dim strIRMInfo As String 
 Select Case irmPermission.Enabled 
 Case True 
 strIRMInfo = "Permissions are already restricted on this document." 
 Case False 
 With irmPermission 
 .Enabled = True 
 .ApplyPolicy ("\\server\share\permissionpolicy.xml") 
 End With 
 strIRMInfo = "Permissions are now restricted on this document " & _ 
 vbCrLf & _ 
 " and the permission policy has been applied." 
 End Select 
 MsgBox strIRMInfo, vbInformation + vbOKOnly, "IRM Information" 
 Set irmPermission = 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.