Workbook.ProtectWindows Property (2007 System)

Gets a value that indicates whether the windows of the workbook are protected.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public ReadOnly Property ProtectWindows As Boolean
'Usage
Dim instance As Workbook 
Dim value As Boolean 

value = instance.ProtectWindows
public bool ProtectWindows { get; }
public:
property bool ProtectWindows {
    bool get ();
}
public function get ProtectWindows () : boolean

Property Value

Type: System.Boolean
true if the windows of the workbook are protected; otherwise, false.

Examples

The following code example uses the Protect method to protect the structure of the workbook and workbook windows, but without specifying password protection. The example then checks the values of the ProtectStructure and ProtectWindows properties to verify that this protection is set.

This example is for a document-level customization.

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.");
    }
}

.NET Framework Security

See Also

Reference

Workbook Class

Workbook Members

Microsoft.Office.Tools.Excel Namespace