Workbook.ProtectStructure Property (2007 System)
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.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public ReadOnly Property ProtectStructure As Boolean
'Usage
Dim instance As Workbook
Dim value As Boolean
value = instance.ProtectStructure
public bool ProtectStructure { get; }
public:
property bool ProtectStructure {
bool get ();
}
public function get ProtectStructure () : boolean
Property Value
Type: System.Boolean
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 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.