+ Reply to Thread
Results 1 to 2 of 2

Run Time Error '1004' File Could Not Be Found

  1. #1
    Forum Contributor
    Join Date
    02-15-2010
    Location
    Everett, WA
    MS-Off Ver
    All versions; most components
    Posts
    188

    Run Time Error '1004' File Could Not Be Found

    Greetings,

    I have a series of macros, a couple of which access files in a directory. I ran the macros dozens of times yesterday with no issues, but today, I get the "Run Time Error '1004'" file could not be found error in one of the macros. To make it even more bizarre, the program is able to find the directory just fine in the block above the one that is failing. I have spent hours researching this problem, have tried many of the suggestions I have found in various forums, and still can not get it to work. I am absolutely positive that the directory exists, that the path is correct, and that this is not due to a security setting (I copied the folder path directly out of Widows Explorer and, as I stated above, the program is able to access the folder in a previous block of code).

    All the code from the start of the program through the Sub that is failing is below.

    The failure occurs in "Sub Copy_MostRecent_Data" on the line "Workbooks.Open (drct & fname)"

    I would greatly appreciate some help here!

    Thanks!

    Please Login or Register  to view this content.
    Last edited by gyclone; 02-18-2010 at 05:35 AM.

  2. #2
    Forum Contributor
    Join Date
    02-15-2010
    Location
    Everett, WA
    MS-Off Ver
    All versions; most components
    Posts
    188

    Re: Run Time Error '1004' File Could Not Be Found

    Okay,

    I finally figured this one out. The error message was suggesting that it was the directory that couldn't be found when in fact it was the file itself that couldn't be found. I had properly assigned the file name to the variable in one part of the if/then statement in the sub above, but not all of them. I guess that's what a couple days without sleep will do to a person. I cleaned up some of the other code in that sub, as well. I still don't understand why it worked yesterday and not today, but I'm gonna let that go and move on.

    In case anyone is interested, the new code is as follows:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1