Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Excel 2007 change pivot data source

I have a pivot attached to a list on a tab in the same workbook. When I
click on the Change Data Source option, the "Use an External Data Source"
button is greyed out (I have a connection created already which I could
select).

How can I change the pivot from a local to an external data source?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default Excel 2007 change pivot data source

You could create a temporary pivot table based on the connection to the
database. Then, programmatically set all the existing pivot tables to use the
same pivot cache.
For example, with the temporary pivot table on a worksheet named Temp:

'====================
Sub ChangeCache()
Dim ptNew As PivotTable
Dim ws As Worksheet
Dim pt As PivotTable

Set ptNew = Worksheets("Temp").PivotTables(1)
Debug.Print ptNew.CacheIndex

For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.CacheIndex = ptNew.CacheIndex
Next pt
Next ws

End Sub
'==========================
--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


"bdub" wrote:

I have a pivot attached to a list on a tab in the same workbook. When I
click on the Change Data Source option, the "Use an External Data Source"
button is greyed out (I have a connection created already which I could
select).

How can I change the pivot from a local to an external data source?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Excel 2007 change pivot data source

This code did it, thanks (tho', there really should be a way to do this
manually).

bdub

"Debra Dalgleish" wrote:

You could create a temporary pivot table based on the connection to the
database. Then, programmatically set all the existing pivot tables to use the
same pivot cache.
For example, with the temporary pivot table on a worksheet named Temp:

'====================
Sub ChangeCache()
Dim ptNew As PivotTable
Dim ws As Worksheet
Dim pt As PivotTable

Set ptNew = Worksheets("Temp").PivotTables(1)
Debug.Print ptNew.CacheIndex

For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.CacheIndex = ptNew.CacheIndex
Next pt
Next ws

End Sub
'==========================
--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


"bdub" wrote:

I have a pivot attached to a list on a tab in the same workbook. When I
click on the Change Data Source option, the "Use an External Data Source"
button is greyed out (I have a connection created already which I could
select).

How can I change the pivot from a local to an external data source?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default Excel 2007 change pivot data source

I haven't found an efficient way to do it manually. You can open the old
PivotTable Wizard (Alt+D, p) and go back to Step 1, and change to an external
data source. Then select the database that you want to use.

--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


"bdub" wrote:

This code did it, thanks (tho', there really should be a way to do this
manually).

bdub

"Debra Dalgleish" wrote:

You could create a temporary pivot table based on the connection to the
database. Then, programmatically set all the existing pivot tables to use the
same pivot cache.
For example, with the temporary pivot table on a worksheet named Temp:

'====================
Sub ChangeCache()
Dim ptNew As PivotTable
Dim ws As Worksheet
Dim pt As PivotTable

Set ptNew = Worksheets("Temp").PivotTables(1)
Debug.Print ptNew.CacheIndex

For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.CacheIndex = ptNew.CacheIndex
Next pt
Next ws

End Sub
'==========================
--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


"bdub" wrote:

I have a pivot attached to a list on a tab in the same workbook. When I
click on the Change Data Source option, the "Use an External Data Source"
button is greyed out (I have a connection created already which I could
select).

How can I change the pivot from a local to an external data source?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Excel 2007 change pivot data source

I've tried this several times - and each time Excel sends an error report and
shuts down. ugh...

"Debra Dalgleish" wrote:

I haven't found an efficient way to do it manually. You can open the old
PivotTable Wizard (Alt+D, p) and go back to Step 1, and change to an external
data source. Then select the database that you want to use.

--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


"bdub" wrote:

This code did it, thanks (tho', there really should be a way to do this
manually).

bdub

"Debra Dalgleish" wrote:

You could create a temporary pivot table based on the connection to the
database. Then, programmatically set all the existing pivot tables to use the
same pivot cache.
For example, with the temporary pivot table on a worksheet named Temp:

'====================
Sub ChangeCache()
Dim ptNew As PivotTable
Dim ws As Worksheet
Dim pt As PivotTable

Set ptNew = Worksheets("Temp").PivotTables(1)
Debug.Print ptNew.CacheIndex

For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.CacheIndex = ptNew.CacheIndex
Next pt
Next ws

End Sub
'==========================
--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


"bdub" wrote:

I have a pivot attached to a list on a tab in the same workbook. When I
click on the Change Data Source option, the "Use an External Data Source"
button is greyed out (I have a connection created already which I could
select).

How can I change the pivot from a local to an external data source?

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
Excel 2007 change data source Bart Excel Discussion (Misc queries) 1 October 4th 06 11:19 AM
change data source of pivot table JohnH Excel Discussion (Misc queries) 9 September 15th 06 12:52 AM
change the ODBC data source of a pivot table JohnH Excel Discussion (Misc queries) 0 August 16th 06 07:10 PM
Can't change source data path for Pivot Chart Mike B in VT Charts and Charting in Excel 1 February 18th 06 11:43 PM


All times are GMT +1. The time now is 08:12 PM.

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

About Us

"It's about Microsoft Excel"