WorksheetBase.EnableSelection (Propiedad)
Obtiene o establece un valor que indica qué celdas se pueden seleccionar en la hoja.
Espacio de nombres: Microsoft.Office.Tools.Excel
Ensamblado: Microsoft.Office.Tools.Excel.v4.0.Utilities (en Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Sintaxis
'Declaración
Public Property EnableSelection As XlEnableSelection
public XlEnableSelection EnableSelection { get; set; }
Valor de propiedad
Tipo: Microsoft.Office.Interop.Excel.XlEnableSelection
Uno de los valores de XlEnableSelection.
Comentarios
Esta propiedad sólo tiene efecto cuando la hoja de cálculo está protegida: xlNoSelection impide la selección en la hoja, xlUnlockedCells sólo permite que se seleccionen las celdas que no están bloqueadas y xlNoRestrictions permite seleccionar cualquier celda.
Ejemplos
El ejemplo de código siguiente utiliza el método Protect para proteger la hoja de cálculo y, a continuación, utiliza la propiedad EnableSelection para impedir que se seleccionen celdas de la hoja de cálculo.
Se trata de un ejemplo para una personalización en el nivel del documento.
Private Sub ProtectAndDisableSelection()
Me.Protect(DrawingObjects:=True, Contents:=True, Scenarios:=True, _
UserInterfaceOnly:=True, AllowFormattingCells:=True, _
AllowFormattingColumns:=False, AllowFormattingRows:=False, _
AllowInsertingColumns:=False, AllowInsertingRows:=False, _
AllowInsertingHyperlinks:=False, AllowDeletingColumns:=False, _
AllowDeletingRows:=False, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True)
Me.EnableSelection = Excel.XlEnableSelection.xlNoSelection
End Sub
private void ProtectAndDisableSelection()
{
this.Protect(true, true, true, true, true,
false, false, false, false, false, false, false, true,
true, true);
this.EnableSelection = Excel.XlEnableSelection.xlNoSelection;
}
Seguridad de .NET Framework
- Plena confianza para el llamador inmediato. Un código de confianza parcial no puede utilizar este miembro. Para obtener más información, vea Utilizar bibliotecas de código que no es de plena confianza.