Change Pivot Source SQL Database

EvonS

Board Regular
Joined
Jun 1, 2016
Messages
111
Office Version
  1. 365
Platform
  1. Windows
  2. Web
My IT department for work moved all my source data to a new server so now I need all my pivot tables on multiple sheets to switch over to the new data source. Is there an easy way to do this?

All the instructions I've seen online address changing the source files or cell ranges but not changing a database.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
If you run the code below it may give you some idea of where to start.

VBA Code:
Public Sub Test()
    Dim wb As Excel.Workbook
    Dim pc As PivotCache
    Dim path As String

    Set wb = ActiveWorkbook
    path = wb.path

    For Each pc In wb.PivotCaches
        Debug.Print pc.Connection
    Next
End Sub
 
Upvote 0
If you run the code below it may give you some idea of where to start.

VBA Code:
Public Sub Test()
    Dim wb As Excel.Workbook
    Dim pc As PivotCache
    Dim path As String

    Set wb = ActiveWorkbook
    path = wb.path

    For Each pc In wb.PivotCaches
        Debug.Print pc.Connection
    Next
End Sub
Thanks but nothing happened when I ran the code.
 
Upvote 0
I only had a connection to an access database, but are you saying the debug.print showed nothing in the vba immediate window ?
 
Upvote 0
I only had a connection to an access database, but are you saying the debug.print showed nothing in the vba immediate window ?
Correct. Nothing popped up. I started to change the pivots manually and for some reason all the sources of the other pivot tables updated automatically. I have no idea why but it worked in my favour. Thanks for the help.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top