Version

WorksheetProtection Class

Provides information about the types of changes that are disabled when the associated Worksheet is protected.
Syntax
'Declaration
 
Public Class WorksheetProtection 
   Inherits SheetProtection
public class WorksheetProtection : SheetProtection 
Remarks

When a Worksheet is protected, the contents of unprotected cells may be edited by the end-user. One way to unprotect a cell is to change the IWorksheetCellFormat.Locked property to false. Such cells may be edited by all users. Another way to unprotect cells is using the AllowedEditRanges. This is a collection of WorksheetProtectedRange instances that define a range of cells that is optionally protected by another password. For any other cells, the Worksheet would need to be unprotected first. A Worksheet may be programatically unprotected using the Sheet.Unprotect method or conditionally based on matching a specified password using the Sheet.Unprotect method.

The SelectionMode property is used to control which cells the end user may select when the Worksheet has been protected. This property may be set before or after protecting a Worksheet.

Many of the other properties of this class are read-only (e.g. AllowDeletingColumns). The state of these properties are optionally set when the Worksheet is protected (e.g. using the Worksheet.Protect method.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also