View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.charting
ShaneDevenshire ShaneDevenshire is offline
external usenet poster
 
Posts: 2,344
Default View/Change Pivot Table Query

Hi,

I don't have time to test now but 1. Select your pivot table and choose
PivotTable, Table Options, and note the Name of the pivot table.
2. Replace "PivotTable" with the correct name.

--
Thanks,
Shane Devenshire


"ToniS" wrote:

I am currently using Excel 2003. I would like to look at a PivotTable's SQL
Query, but unsure on how to do this. I did find one posting with a VBA
solution, so I tried it. I get the following error:
'Unable to get the Pivot Tables property of the worksheet class'

Below is the source code

Sub Get_PT_Source_Code()
Dim pvtTable As PivotTable
Dim index As Integer

Set pvtTable = ActiveSheet.PivotTables("PivotTable")

With pvtTable.PivotCache

Debug.Print .CommandText 'the SQL Query
Debug.Print .Connection 'the connection
End With

End Sub

I basically would like to view and maybe change how the pivot table is
displaying the data. Any help would be greatly appreciated.

Thanks
TSharp.