Export (0) Print
Expand All
Expand Minimize

Workbook.ProtectStructure Property

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

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public virtual bool ProtectStructure { get; }

Property Value

true if the order of the sheets in the workbook is protected; otherwise, false.

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.

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

© 2014 Microsoft