Share via


Permission.RemoveAll Method

Office Developer Reference

Removes all UserPermission objects from the Permission collection of the active document.

Syntax

expression.RemoveAll

expression   A variable that represents a Permission object.

Remarks

The RemoveAll method removes all UserPermissions that have been added to the Permission collection and disables restrictions on the active document. After calling the RemoveAll method, the Enabled property of the Permission object returns False and the Count property returns 0 (zero).

Example

The following example uses the RemoveAll method to remove all user permissions and to disable restrictions on the active document.

Visual Basic for Applications
      Dim irmPermission As Office.Permission
    Set irmPermission = ActiveWorkbook.Permission
    If irmPermission.Enabled Then
        irmPermission.RemoveAll
        MsgBox "All permissions removed." & vbCrLf & _
            "Count: " & irmPermission.Count & vbCrLf & _
            "Enabled: " & irmPermission.Enabled, _
            vbInformation + vbOKOnly, "IRM Information"
    Else
        MsgBox "This document is not restricted.", _
            vbInformation + vbOKOnly, "IRM Information"
    End If
    Set irmPermission = Nothing

See Also