Partager via


WorksheetBase.EnableSelection, propriété

Obtient ou définit une valeur qui indique quelles cellules peuvent être sélectionnées sur la feuille.

Espace de noms :  Microsoft.Office.Tools.Excel
Assembly :  Microsoft.Office.Tools.Excel.v4.0.Utilities (dans Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntaxe

'Déclaration
Public Property EnableSelection As XlEnableSelection
public XlEnableSelection EnableSelection { get; set; }

Valeur de propriété

Type : Microsoft.Office.Interop.Excel.XlEnableSelection
Une des valeurs de XlEnableSelection.

Notes

Cette propriété entre uniquement en vigueur lorsque la feuille de calcul est protégée : xlNoSelection empêche toute sélection sur la feuille, xlUnlockedCells autorise uniquement les cellules qui ne sont pas verrouillées à être sélectionnées et xlNoRestrictions autorise n'importe quelle cellule à être sélectionnée.

Exemples

L'exemple de code suivant utilise la méthode Protect pour protéger la feuille de calcul, puis utilise la propriété EnableSelection pour empêcher toute cellule sur la feuille de calcul d'être sélectionnée.

Cet exemple illustre une personnalisation au niveau du document.

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;
}

Sécurité .NET Framework

Voir aussi

Référence

WorksheetBase Classe

Microsoft.Office.Tools.Excel, espace de noms