Permission.RemoveAll method (Office)
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.
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
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.