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]
Property EnableSelection As XlEnableSelection
[C#]
XlEnableSelection EnableSelection { get; set; }
[C++]
__property XlEnableSelection get_EnableSelection();
__property void set_EnableSelection(XlEnableSelection );
[JScript]
function get EnableSelection() : XlEnableSelection
function set EnableSelection(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();
[Visual Basic]
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