WorkbookBase.ProtectWindows Propriedade

Definição

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

public bool ProtectWindows { get; }

Valor da propriedade

Boolean

true se as janelas da pasta de trabalho estiverem protegidas; caso contrário, false.

Exemplos

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

Este exemplo destina-se a uma personalização no nível de documento.

private void ProtectWorkbook()
{
    this.Protect( 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.");
    }
}
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

Aplica-se a