Error 1004 - unable to read file

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Unusual

Thread Starter
Joined
Jan 22, 2009
Messages
92
Hi All

I have an interesting problem that I would really appreciate assistance solving.


I have the following simple code in a VBA Excel module:

Set BookResults = Workbooks.Open("C:\MVAA\trial.xls")

This code always used to work fine no problems in Office 2007. Then all of a sudden I started occasionally getting an error "Error 1004 - unable to read file"

A few days ago I upgraded to Office 2010. Now every time I run this code the first time it works fine...but then if I try and run it again I get the same error! The only way around this is to restart my PC!

I am really scratching my head about this one

Any ideas?

Thanks a lot
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
Really is strange, the line of code you're using works fine here (other folder and filename) but it works.
I used Excel 2007 to test it.

Did you change your 'trusted environment' ? Maybe you updated virus definitions?
No further bright ideas on this side, sorry
 

Unusual

Thread Starter
Joined
Jan 22, 2009
Messages
92
Thanks Keebellah I added the folder where these files are stored to my "trusted locations", but I haven't experienced any other problems as a result of this. Also doesn't seem to be linked to anti virus software at all. Thanks anyway
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
I Googled on Excel "Error 1004 - unable to read file" and got quite a lot of hits (also this forum) but many others and it seems there's an issue but no one can really pinpoint it.
Maybe it's an IDFLDAT error...


I Don't Feel Like Doing Anything Today :)
 

Unusual

Thread Starter
Joined
Jan 22, 2009
Messages
92
Yes...I also got the feeling that it is something very broad that is not so simple to fix. At this stage I would be more than satisfied to at least to try and find some sort of workaround, even if the issue cannot be resolved fully. Thanks again
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
Didn't you read my answer??????

I Don't Feel Like Doing Anything Today :)
 

Unusual

Thread Starter
Joined
Jan 22, 2009
Messages
92
Oooooh...sorry, I thought that was some sort of status update of yours. Didn't realize that it related to my query! Well let me know if you get any other ideas how to beat it back into shape and to start wanting to work again! Thanks
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,612
Sorry,I did some testing but cannot find a plausible reason. :( (n)
 

Unusual

Thread Starter
Joined
Jan 22, 2009
Messages
92
Hi All

I just wanted to let everyone know that I managed to stumble across a solution to my problem although I haven't the foggiest idea why it works!!!

If I add in a MessageBox one line before the problematic line that crashes, then this prevents the crash!!!

I tested it many times and it seems to work every time.

Bizarre but at least it sorts it out.
 

Unusual

Thread Starter
Joined
Jan 22, 2009
Messages
92
I found an even easier solution. Instead of using a messagebox just before the line that crashes, I created a one second delay in the program which achieves the sames purpose.

To do this I used:

Application.Wait Now + TimeSerial(0, 0, 1)

Does the trick!

Hopefully this will help anyone else with the same problem.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top