共用方式為


WorkbookBase.ProtectStructure Property

Definition

Gets a value that indicates whether the order of the sheets in the workbook is protected.

public:
 property bool ProtectStructure { bool get(); };
public bool ProtectStructure { get; }
member this.ProtectStructure : bool
Public ReadOnly Property ProtectStructure As Boolean

Property Value

true if the order of the sheets in the workbook is 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 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

Applies to