Expand Minimize

WorksheetBase.Names Property

Gets a Microsoft.Office.Interop.Excel.Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix).

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public Names Names { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.Names
A Microsoft.Office.Interop.Excel.Names collection that represents all the worksheet-specific names (names defined with the "WorksheetName!" prefix).

The following code example uses the Names property to add a name to the worksheet. The example then displays the Define Name dialog to verify that the name was added.

This example is for a document-level customization.

private void AddName()
{
    Excel.Name name1 = this.Names.Add("Microsoft",
        this.Range["A1"], true, "Ctrl-R");

    // Show Define Name dialog to verify that the Name was added. 
    this.Application.Dialogs[Excel.XlBuiltInDialog.xlDialogDefineName].Show();
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft