Cannot read file error when running Macro

karen1573

New Member
Joined
May 29, 2009
Messages
6
Hi there

I have a macro of which there's a part which opens another workbook. However the macro stops and reports "Run-time error '1004' Unable to read file.

When I open that workbook manually, however, Excel will read it fine.

Any ideas? The path to the workbook is definitely correct.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,
How are you opening the file in code, and what format is the file in?
 
Upvote 0
PS. The macro also opens another workbook with the exact same code, and the workbook it opens is exactly the same as the problem one, but with different data. That one opens without problems. :confused:
 
Upvote 0
If you open the file manually, save and close it, does the code work then, as a matter of interest?
 
Upvote 0
How is the workbook created? By a server application?
You might try adding the CorruptLoad argument to your Open statement:
Code:
Workbooks.Open Filename:= _
"\\netappa\PUBLIC\Daily Telemarketing\Platform Analysts\Chesterfield\Absence\Absence_MTD.xls", CorruptLoad:=xlRepairFile
to see if that helps.
 
Upvote 0
Yes, it's exported as .xls format by our business information server (which is running Business Objects XI).

Tried the corruptLoad statement, but no luck :(
 
Upvote 0
You might try and see if you can find out what version of Excel it's supposed to export to.
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,654
Members
449,113
Latest member
Hochanz

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