Name Property

Microsoft Excel Visual Basic

Returns or sets the name of the object. Read/write String.

expression.Name

expression    Required. An expression that returns one of the above objects.

ShowName property as it applies to the AddIn, Application, AxisTitle, CalculatedMember, ChartArea, ChartTitle, Corners, CubeField, CustomView, DataLabel, DataLabels, DisplayUnitLabel, DownBars, DropLines, ErrorBars, Floor, Gridlines, HiLoLines, Hyperlink, Legend, PlotArea, RecentFile, SeriesLines, SmartTag, SmartTagAction, Style, TickLabels, UpBars, Walls, and Workbook objects.

Returns the name of the object. Read-only String.

expression.Name

expression    Required. An expression that returns one of the above objects.

ShowName property as it applies to the Font and Range objects.

Returns or sets the name of the object. The name of a Range object is a Name object. For every other type of object, the name is a String. Read/write Variant.

expression.Name

expression    Required. An expression that returns one of the above objects.

ShowName property as it applies to the ListColumn object.

Returns or sets the name of the list column. This is also used as the display name of the list column. This name must be unique within the list. Read/write String.

expression.Name

expression    Required. An expression that returns a ListColumn object.

Note  If this list is linked to a SharePoint list, this property is read-only.

ShowName property as it applies to the ListObject object.

Returns or sets the name of the ListObject object. This name is used solely as a unique identifier for the Item property of the ListObjects collection objects. This property can only be set through the object model. Read/write String.

expression.Name

expression    Required. An expression that returns an ListObject object.

Remarks

By default, each ListObject object name begins with the word "List", followed by a number (no spaces). If an attempt is made to set the Name property to a name already used by another ListObject object, a run-time error is thrown.

ShowName property as it applies to the XmlMap object.

Returns or sets the friendly name used to uniquely identify a mapping in the workbook. Read/write String.

expression.Name

expression    Required. An expression that returns an XmlMap object.

Remarks

The string specified for the Name property must be unique within the workbook, and cannot exceed 255 characters.

Remarks

The following table shows example values of the Name property and related properties given an OLAP data source with the unique name "[Europe].[France].[Paris]" and a non-OLAP data source with the item name "Paris".

Property Value (OLAP data source) Value (non-OLAP data source)
Caption Paris Paris
Name [Europe].[France].[Paris] (read-only) Paris
SourceName [Europe].[France].[Paris] (read-only) (Same as SQL property value, read-only)
Value [Europe].[France].[Paris] (read-only) Paris

When specifying an index into the PivotItems collection, you can use the syntax shown in the following table.

Syntax (OLAP data source) Syntax (non-OLAP data source)
expression.PivotItems("[Europe].[France].[Paris]") expression.PivotItems("Paris")

When using the Item property to reference a specific member of a collection, you can use the text index name as shown in the following table.

Name (OLAP data source) Name (non-OLAP data source)
[Europe].[France].[Paris] Paris

Example

This example displays the name of style one in the active workbook, first in the language of the macro and then in the language of the user.

With ActiveWorkbook.Styles(1)
    MsgBox "The name of the style: " & .Name
    MsgBox "The localized name of the style: " & .NameLocal
End With
		

The following example displays the name of the default ListObject object in sheet1 of the active workbook.

   
Sub Test  
 Dim wrksht As Worksheet
   Dim oListObj As ListObject
   
   Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
   Set oListObj = wrksht.ListObjects(1)
   
   MsgBox oListObj.Name  
End Sub