Compartir a través de


NamedRange.InnerObject Property

Definition

Gets a Range that represents the underlying native object for the NamedRange.

public:
 property Microsoft::Office::Interop::Excel::Range ^ InnerObject { Microsoft::Office::Interop::Excel::Range ^ get(); };
public Microsoft.Office.Interop.Excel.Range InnerObject { get; }
member this.InnerObject : Microsoft.Office.Interop.Excel.Range
Public ReadOnly Property InnerObject As Range

Property Value

A Range that represents the underlying native object for the NamedRange.

Examples

The following code example starts a series of day names and then creates a NamedRange to contain the series. It then uses the Microsoft.Office.Interop.Excel.Range.AutoFill* method to complete the series. Microsoft.Office.Interop.Excel.Range.AutoFill* requires a Microsoft.Office.Interop.Excel.Range as a parameter.

This example is for a document-level customization.

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);
}
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

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.

Applies to