WorkbookBase.Parent Property
Gets the parent object for the workbook.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)
Syntax
'Declaration
Public ReadOnly Property Parent As Object
public Object Parent { get; }
Property Value
Type: System.Object
The parent object for the workbook.
Examples
The following code example uses the Parent property to display the name of the parent of the current workbook.
This example is for a document-level customization.
Private Sub DisplayParentName()
Dim parentObject As Excel.Application = _
CType(Me.Parent, Excel.Application)
MsgBox("The parent of the current workbook is: " & _
parentObject.Name)
End Sub
private void DisplayParentName()
{
Excel.Application parentObject = (Excel.Application)this.Parent;
MessageBox.Show("The parent of the current workbook is: " +
parentObject.Name);
}
.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.