SpreadsheetGear 2023
Protect Method (IWorksheet)


SpreadsheetGear Namespace > IWorksheet Interface : Protect Method
Enables protection for this worksheet with the optional password, protect* and allow* options.
Syntax
'Declaration
 
Sub Protect( _
   Optional ByVal password As System.String, _
   Optional ByVal protectDrawingObjects As System.Boolean, _
   Optional ByVal protectContents As System.Boolean, _
   Optional ByVal protectScenarios As System.Boolean, _
   Optional ByVal userInterfaceOnly As System.Boolean, _
   Optional ByVal allowFormattingCells As System.Boolean, _
   Optional ByVal allowFormattingColumns As System.Boolean, _
   Optional ByVal allowFormattingRows As System.Boolean, _
   Optional ByVal allowInsertingColumns As System.Boolean, _
   Optional ByVal allowInsertingRows As System.Boolean, _
   Optional ByVal allowInsertingHyperlinks As System.Boolean, _
   Optional ByVal allowDeletingColumns As System.Boolean, _
   Optional ByVal allowDeletingRows As System.Boolean, _
   Optional ByVal allowSorting As System.Boolean, _
   Optional ByVal allowFiltering As System.Boolean, _
   Optional ByVal allowUsingPivotTables As System.Boolean _
) 
'Usage
 
Dim instance As IWorksheet
Dim password As System.String
Dim protectDrawingObjects As System.Boolean
Dim protectContents As System.Boolean
Dim protectScenarios As System.Boolean
Dim userInterfaceOnly As System.Boolean
Dim allowFormattingCells As System.Boolean
Dim allowFormattingColumns As System.Boolean
Dim allowFormattingRows As System.Boolean
Dim allowInsertingColumns As System.Boolean
Dim allowInsertingRows As System.Boolean
Dim allowInsertingHyperlinks As System.Boolean
Dim allowDeletingColumns As System.Boolean
Dim allowDeletingRows As System.Boolean
Dim allowSorting As System.Boolean
Dim allowFiltering As System.Boolean
Dim allowUsingPivotTables As System.Boolean
 
instance.Protect(password, protectDrawingObjects, protectContents, protectScenarios, userInterfaceOnly, allowFormattingCells, allowFormattingColumns, allowFormattingRows, allowInsertingColumns, allowInsertingRows, allowInsertingHyperlinks, allowDeletingColumns, allowDeletingRows, allowSorting, allowFiltering, allowUsingPivotTables)
void Protect( 
   System.string password,
   System.bool protectDrawingObjects,
   System.bool protectContents,
   System.bool protectScenarios,
   System.bool userInterfaceOnly,
   System.bool allowFormattingCells,
   System.bool allowFormattingColumns,
   System.bool allowFormattingRows,
   System.bool allowInsertingColumns,
   System.bool allowInsertingRows,
   System.bool allowInsertingHyperlinks,
   System.bool allowDeletingColumns,
   System.bool allowDeletingRows,
   System.bool allowSorting,
   System.bool allowFiltering,
   System.bool allowUsingPivotTables
)

Parameters

password
protectDrawingObjects
protectContents
protectScenarios
userInterfaceOnly
allowFormattingCells
allowFormattingColumns
allowFormattingRows
allowInsertingColumns
allowInsertingRows
allowInsertingHyperlinks
allowDeletingColumns
allowDeletingRows
allowSorting
allowFiltering
allowUsingPivotTables
Requirements

Target Platforms: 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

Reference

IWorksheet Interface
IWorksheet Members
ProtectContents Property
Unprotect Method
Protection Property
ProtectDrawingObjects Property
ProtectScenarios Property
Locked Property
FormulaHidden Property
ProtectStructure Property
ProtectWindows Property
Protect Method
Unprotect Method