Name Property

Microsoft Excel Visual Basic

Show All

Name Property

       

Name property as it applies to the Chart, ChartObject, ColorFormat, CustomProperty, Name, OLEObject, Parameter, PivotField, PivotItem, PivotTable, QueryTable, Scenario, Series, Shape, ShapeRange, Trendline, and Worksheet objects.

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

expression.Name

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

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

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

expression.Name

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

Name 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.

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 is " & .Name
    MsgBox "The localized name of the style is " & .NameLocal
End With