次の方法で共有


WorkbookBase.ProtectWindows プロパティ

ブックのウィンドウが保護されているかどうかを示す値を取得します。

名前空間:  Microsoft.Office.Tools.Excel
アセンブリ:  Microsoft.Office.Tools.Excel.v4.0.Utilities (Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 内)

構文

'宣言
Public ReadOnly Property ProtectWindows As Boolean
    Get
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.");
    }
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。 このメンバーは、部分的に信頼されているコードから使用することはできません。 詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

WorkbookBase クラス

Microsoft.Office.Tools.Excel 名前空間