Condividi tramite


Proprietà WorkbookBase.ProtectStructure

Ottiene un valore che indica se l'ordine dei fogli nella cartella di lavoro è protetto.

Spazio dei nomi:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintassi

'Dichiarazione
Public ReadOnly Property ProtectStructure As Boolean
    Get
public bool ProtectStructure { get; }

Valore proprietà

Tipo: System.Boolean
true se l'ordine dei fogli nella cartella di lavoro è protetto; in caso contrario, false.

Esempi

Nell'esempio di codice riportato di seguito viene utilizzato il metodo Protect per proteggere la struttura e le finestre della cartella di lavoro, ma senza specificare una protezione con password. Vengono quindi controllati i valori delle proprietà ProtectStructure e ProtectWindows per verificare che questa protezione sia impostata.

Questo esempio è valido per una personalizzazione a livello di documento.

Private Sub ProtectWorkbook()
    Me.Protect(Structure:=True, Windows:=True)

    If Me.ProtectStructure Then
        MsgBox("You cannot add, delete or change the location " & _
            "of sheets in this workbook.")
    End If

    If Me.ProtectWindows Then
        MsgBox("You cannot arrange windows in this workbook.")
    End If
End Sub
private void ProtectWorkbook()
{
    this.Protect(missing, true, true);

    if (this.ProtectStructure)
    {
        MessageBox.Show("You cannot add, delete or change the location " +
            "of sheets in this workbook.");
    }

    if (this.ProtectWindows)
    {
        MessageBox.Show("You cannot arrange windows in this workbook.");
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

WorkbookBase Classe

Spazio dei nomi Microsoft.Office.Tools.Excel