PivotTable.MDX (Excel)
Returns a String indicating the Multidimensional Expression (MDX) that would be sent to the provider to populate the current PivotTable view.
Querying this value for a non-Online Analytical Processing (OLAP) PivotTable, or when there is no PivotTable view (no data items), will return a run-time error.
Dim strMDX As String
strMDX = ActiveCell.PivotTable.MDX