Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 18
Default View/Change Pivot Table Query

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.


  #2   Report Post  
Posted to microsoft.public.excel.charting
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.


  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 18
Default View/Change Pivot Table Query

THANK YOU, I thought the name of the worksheet was the name of the table,
The worksheet name is PivotTable and the actual name of the Pivot table is
Pivot Table4.. Thanks again for your help


"ShaneDevenshire" wrote:

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.


  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,979
Default View/Change Pivot Table Query

You can also use Ron Coderre's Pivot Play Plus add-in to view or change
the connection string:

http://www.contextures.com/xlPivotPlayPLUS01.html

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.




--
Debra Dalgleish
Contextures
www.contextures.com/tiptech.html
Blog: http://blog.contextures.com

  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 116
Default View/Change Pivot Table Query



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




  #6   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 116
Default View/Change Pivot Table Query


An easy way to reference the pivottables is by their index , eg
xlapp.ActiveSheet.PivotTables(1).PivotFields("NAME ")

In my application I tend to have only one pivottable per worksheet, but if I
had more I would know about it.

You could use this to give the pivot table a more meaningful name -
xlapp.ActiveSheet.PivotTables(1).name = "whatever", and then reference it by
name throughout the rest of the code.



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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
View Pivot Table Source Data Mistermonday Excel Discussion (Misc queries) 2 October 27th 07 10:53 PM
Make table query will work in datasheet view but will not make tab WildlyHarry Excel Discussion (Misc queries) 0 August 28th 07 03:06 PM
Excel 2003 view formula within pivot table jpjejmcc Excel Worksheet Functions 3 July 28th 05 06:08 PM
How to view summarized items in a pivot table exceluser New Users to Excel 2 June 14th 05 03:10 AM
How do I go from "Chart View" to "Pivot Table Form" in a Pivot ta. Jersey Girl Excel Discussion (Misc queries) 1 March 10th 05 04:20 AM


All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"