NamedRange.InnerObject Property
Gets a Microsoft.Office.Interop.Excel.Range that represents the underlying native object for the Microsoft.Office.Tools.Excel.NamedRange.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
ReadOnly Property InnerObject As Range
Range InnerObject { get; }
Property Value
Type: Microsoft.Office.Interop.Excel.Range
A Microsoft.Office.Interop.Excel.Range that represents the underlying native object for the Microsoft.Office.Tools.Excel.NamedRange.
Remarks
You can use the InnerObject property to access the underlying Microsoft.Office.Interop.Excel.Range for the NamedRange and pass it to a method or property that expects a Microsoft.Office.Interop.Excel.Range passed as a Microsoft.Office.Interop.Excel.Range. For more information, see Programmatic Limitations of Host Items and Host Controls.
Examples
The following code example starts a series of day names and then creates a NamedRange to contain the series. It then uses the AutoFill method to complete the series. AutoFill requires a Microsoft.Office.Interop.Excel.Range as a parameter.
This example is for a document-level customization.
Private Sub InnerRange()
Me.Range("A1").Value2 = "Sunday"
Me.Range("A2").Value2 = "Monday"
Dim dayRange As Microsoft.Office.Tools.Excel.NamedRange = _
Me.Controls.AddNamedRange(Me.Range("A1", "A7"), _
"dayRange")
Me.Range("A1", "A2").AutoFill(dayRange.InnerObject, _
Excel.XlAutoFillType.xlFillDays)
End Sub
private void InnerRange()
{
this.Range["A1"].Value2 = "Sunday";
this.Range["A2"].Value2 = "Monday";
Microsoft.Office.Tools.Excel.NamedRange dayRange =
this.Controls.AddNamedRange(this.Range["A1", "A7"],
"dayRange");
this.Range["A1", "A2"].AutoFill(dayRange.InnerObject,
Excel.XlAutoFillType.xlFillDays);
}
.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.