Sub MyMacro()
ConvertPivotReferences " S:\Data\Client", " S:\Client"
End Sub
Public Sub ConvertPivotReferences( _
ByVal OldPath As String, _
ByVal NewPath As String _
)
Dim Pivot As PivotCache
Dim Connection As String
Dim Position As Long
Dim Count As Long
For Each Pivot In ThisWorkbook.PivotCaches
Connection = Pivot.Connection
If InStr(Connection, OldPath) > 0 Then
Connection = Replace(Connection, OldPath, NewPath)
Count = Count + 1
End If
Pivot.Connection = Connection
Next
MsgBox Count & " PivotTables changed."
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE