SourceName Property

Microsoft Excel Visual Basic

Returns or sets the specified object's link source name. Read/write String.

expression.SourceName

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

ShowSourceName property as it applies to the CalculatedMember and PivotField objects.

Returns the specified object’s name as it appears in the original source data for the specified PivotTable report. This might be different from the current item name if the user renamed the item after creating the PivotTable report. Read-only String.

expression.SourceName

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

ShowSourceName property as it applies to the PivotItem object.

Returns the specified object’s name as it appears in the original source data for the specified PivotTable report. This might be different from the current item name if the user renamed the item after creating the PivotTable report. Read-only Variant.

expression.SourceName

expression    Required. An expression that returns a PivotItem object.

Remarks

The following table shows example values of the SourceName 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 names, as shown in the following table.

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

Example

ShowAs it applies to the PivotItem object.

This example displays the original name (the name from the source database) of the item that contains the active cell.

Worksheets("Sheet1").Activate
ActiveSheet.PivotTables(1).PivotSelect "1998", xlDataAndLabel
MsgBox "The original item name is " & _
    ActiveCell.PivotItem.SourceName