共用方式為


XmlMappedRange.Name 屬性

取得或設定值,表示 XmlMappedRange 控制項的定義名稱。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel (在 Microsoft.Office.Tools.Excel.dll 中)

語法

'宣告
Property Name As Object
Object Name { get; set; }

屬性值

型別:System.Object
Microsoft.Office.Interop.Excel.Name ,表示 XmlMappedRange 控制項的定義名稱。

範例

下列程式碼範例將參考 XmlMappedRange 所佔用的儲存格之 Microsoft.Office.Interop.Excel.Name 加入目前工作表。然後此範例使用 Name 屬性來顯示目前參考 XmlMappedRange 的名稱。這個程式碼範例假設目前工作表包含名為 CustomerLastNameCell 的 XmlMappedRange

Private Sub DisplayName()
    ' Get the location of the XmlMappedRange and prefix it with a "=".
    Dim location As String = Me.CustomerLastNameCell.Address( _
        True, True, Excel.XlReferenceStyle.xlA1, False)
    location = location.Insert(0, "=")

    ' Add a name at the location of the XmlMappedRange.
    Me.Names.Add("LastName", location)

    ' Get the Name of the XmlMappedRange and display the name.
    Dim name2 As Excel.Name = CType(Me.CustomerLastNameCell.Name, Excel.Name)
    MsgBox("The name of CustomerLastNameCell is: " & name2.Name)
End Sub
private void DisplayName()
{
    // Get the location of the XmlMappedRange and prefix it with a "=".
    string location = this.CustomerLastNameCell.Address[true, true,
        Excel.XlReferenceStyle.xlA1, false];
    location = location.Insert(0, "=");

    // Add a name at the location of the XmlMappedRange.
    this.Names.Add("LastName", location);

    // Get the Name of the XmlMappedRange and display the name.
    Excel.Name name2 = ((Excel.Name)this.CustomerLastNameCell.Name);
    MessageBox.Show(name2.Name);
}

.NET Framework 安全性

請參閱

參考

XmlMappedRange 介面

Microsoft.Office.Tools.Excel 命名空間