Workbook.ProtectWindows 属性 (2007 system)

更新:2007 年 11 月

获取一个值,该值指示工作簿窗口是否受保护。

命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel.v9.0(在 Microsoft.Office.Tools.Excel.v9.0.dll 中)

语法

声明
Public ReadOnly Property ProtectWindows As Boolean
用法
Dim instance As Workbook
Dim value As Boolean

value = instance.ProtectWindows
public bool ProtectWindows { get; }

属性值

类型:System.Boolean

如果工作簿窗口受保护,则为 true;否则为 false。

示例

下面的代码示例使用 Protect 方法在不指定密码保护的情况下保护工作簿结构和工作簿窗口。然后,此示例检查 ProtectStructure 和 ProtectWindows 属性的值,验证已设置了此保护。

此示例针对的是文档级自定义项。

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

权限

另请参见

参考

Workbook 类

Workbook 成员

Microsoft.Office.Tools.Excel 命名空间