Run time error 1004

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Getting an error on this..
Run time error 1004
Analysis.xlsx could not be found.

Path is correct.. What it can be, pls guide..
Code:
Range("A4").Select

ActiveSheet.PivotTables("PivotTable2").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Pth & "\" & "[ANALYSIS.xlsx]Details!A:AF", Version:=xlPivotTableVersion14)


Sheets("Tie").Select
Range("B4").Select


ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Dear All Board member,

I believe this really simple for you..Can any one expert can respond on this...Really appriciate for help in advance...

Getting an error on this..
Run time error 1004
Analysis.xlsx could not be found.

Path is correct.. What it can be, pls guide..
Code:
Range("A4").Select

ActiveSheet.PivotTables("PivotTable2").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Pth & "\" & "[ANALYSIS.xlsx]Details!A:AF", Version:=xlPivotTableVersion14)


Sheets("Tie").Select
Range("B4").Select


ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
 
Upvote 0
That seems to imply that it may not be able find the file. You have posted how "Pth" is calculated, so there isn't much we can do to verify that you have done it correctly.

I would recommend doing this to see what it returns, and verify it is a valid path, file name, and sheet, and range. If you do not see any issue, please post here what this MsgBox returns:
Code:
MsgBox [COLOR=#333333][I]Pth & "\" & "[ANALYSIS.xlsx]Details!A:AF"[/I][/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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