Share via


ApplyPolicy Method

Applies the specified permission policy to the active document.

expression.ApplyPolicy(Filename)

*expression   * Required. An expression that returns a Permission object.

*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.

    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

Applies to | Permission Object