I am trying to update the data source of a Pivot table in a worksheet using the below code. I am not very sure what could be the miss here, but I am getting a "Run-time error 5 - Invalid Procedure call or argument" error. Can somebody please help me on this... Thanks in Advance!
Sub PivotSource()
Application.EnableEvents = False
Worksheets("Pivots").Select
ActiveSheet.PivotTables("Pivots_1).ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=("C:\Users\testuser\Documents\My Received Files\[test file - Copy.xlsm]MasterSheet!Master_Range"), Version:=xlPivotTableVersion14)
Application.EnableEvents = True
End Sub
Sub PivotSource()
Application.EnableEvents = False
Worksheets("Pivots").Select
ActiveSheet.PivotTables("Pivots_1).ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=("C:\Users\testuser\Documents\My Received Files\[test file - Copy.xlsm]MasterSheet!Master_Range"), Version:=xlPivotTableVersion14)
Application.EnableEvents = True
End Sub