Propriedade WorkbookBase.ProtectWindows

Obtém um valor que indica se as janelas da pasta de trabalho são protegidas.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (em Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Sintaxe

'Declaração
Public ReadOnly Property ProtectWindows As Boolean
    Get
public bool ProtectWindows { get; }

Valor de propriedade

Tipo: System.Boolean
true Se as janelas da pasta de trabalho são protegidas; Caso contrário, false.

Exemplos

O seguinte exemplo de código usa a Protect método para proteger a estrutura da pasta de trabalho e das janelas da pasta de trabalho, mas sem especificar proteção de senha. O exemplo, em seguida, verifica os valores de ProtectStructure e ProtectWindows Propriedades para verificar se essa proteção é definido.

Este exemplo é para uma personalização em nível de 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.");
    }
}

Segurança do .NET Framework

Consulte também

Referência

WorkbookBase Classe

Namespace Microsoft.Office.Tools.Excel