Share via


Permission.ApplyPolicy Method

Office Developer Reference

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 filename of the permission policy template file.

Remarks

Microsoft Office Information Rights Management supports the use of administrative permission policies which 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.

Visual Basic for Applications
     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