NativeExcel for .Net Developer's Reference

IWorksheet.EnableSelection Property

Gets or sets the value which specifies what can be selected on the sheet.

[Visual Basic]
PropertyEnableSelectionAsXlEnableSelection
[C#]
XlEnableSelectionEnableSelection{get;set;}
[C++]
__propertyXlEnableSelectionget_EnableSelection();
__propertyvoidset_EnableSelection(XlEnableSelection);
[JScript]
functiongetEnableSelection():XlEnableSelection
functionsetEnableSelection(XlEnableSelection);

Property Value

XlEnableSelection enumeration.

Remarks

This property takes effect only when the worksheet is protected.

Example

This example sets worksheet one so that nothing on it can be selected.

[C#]
book.Worksheets[1].EnableSelection = XlEnableSelection.xlNoSelection;
book.Worksheets[1].Protect();
[VisualBasic]
book.Worksheets(i).EnableSelection = XlEnableSelection.xlNoSelection
book.Worksheets(i).Protect()
[C++]
book->Worksheets->Item[i]->EnableSelection = XlEnableSelection::xlNoSelection;

See Also

IWorksheet Interface | NativeExcel Namespace | Protect Method