+ Reply to Thread
Results 1 to 12 of 12

Macro button generates "run time error 1004 [FileName] could not be found' msg

  1. #1
    Registered User
    Join Date
    03-04-2010
    Location
    Wisconsin
    MS-Off Ver
    Excel 2007, Excel 2010, Excel 2003
    Posts
    87

    Thumbs up Macro button generates "run time error 1004 [FileName] could not be found' msg

    Hi All (especially those who are Excel Macro Guru Extraordinaires!)

    I have a situation where I have a Macro File (used to go and grab and consolidate excel files) that was developed for an end-user and while the file works great for me, she gets the following error:

    VB error msg.JPG

    The code for the button is as follows:

    Please Login or Register  to view this content.
    We both use Excel 2010, but need the files to be in 97-2003 format

    I noticed that while the file sizes in my C drive is 205 KB and 203 KB, hers is 200KB. Don't know if this matters. Right now I am grasping at straws since she has everything set up exactly as I do (for purposes of running the macro) She cannot her her files to run. Does the macro need to be modified? Any suggestions on how to resolve this issue?

    Thanks

    Dawn (Guru wannabe)
    Last edited by dawnmau; 03-12-2012 at 11:57 AM. Reason: Issue Resolved
    Dawn - Guru in Training

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    I see that you do not specify the file's location. Excel will then assume the file is in the same directory as the opened file. Is this the case? For your macro to work, she must have the IS_OU_File_Consolidator_2.xls in the same directory she opens the file having the command button.

  3. #3
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Is the file definitely open? It needs to be to run a macro within it.

    If it is, is the filename written correctly within the macro?

  4. #4
    Registered User
    Join Date
    03-04-2010
    Location
    Wisconsin
    MS-Off Ver
    Excel 2007, Excel 2010, Excel 2003
    Posts
    87

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Ok, I will try to answer the questions!

    1. The files are located in the same directory/ folder
    Directory Folder image.JPG

    2. When I run the macro, I don't have the "IS_OU_File_Consolidator_2.xls" file open

    3. Does the order that the file is listed in the folder make a difference?

    Backstory: I will open the "IS_OU_File_Consolidator.xls" file, run the macro and the finshed product is generated.

    Is there any other information I can provide to be of better assistance?

    Thanks so much for putting extra eyes on this. (Let me know if the jpg file doesn't show, I am a visual person and I like to "See" what the other person is seeing, hence, I am big on screen shots)

  5. #5
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    First, the order the files are listed makes no difference at all.
    Second, the file IS_OU_File_Consolidator_2.xls do not have to be open to do what your want to do.

    Now, is the button that call the Application.Run macro part of file IS_OU_File_Consolidator.xls? Or are those 2 files just different version of the same one?

    When I say both files MUST be in the same directory, I mean the file that contains the button you click on to start the macro and the Consolidator one.

    Is there a reason to start that macro from a different file? Why don't you go directly into the IS_OU_File_Consolidator_2.xls file and run the Consolidator macro from there?

  6. #6
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Quote Originally Posted by p24leclerc View Post
    Second, the file IS_OU_File_Consolidator_2.xls do not have to be open to do what your want to do.
    I stand corrected I always thought they had to be open. Learn something new every day!

  7. #7
    Registered User
    Join Date
    03-04-2010
    Location
    Wisconsin
    MS-Off Ver
    Excel 2007, Excel 2010, Excel 2003
    Posts
    87

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Hi p24leclerc,
    The reason for the 2 files is due to the way the macro was set up. I will provide a sample of the macro that may provide some clues.

    Please Login or Register  to view this content.
    I modified this file from another user to be used for another division. All applicable changes were made and tested before I sent the 2 consolidator files. I provided explicit instructions as to how to "install" the files. I did a line by line compare with the macro from her files (ones I sent her) to mine and cannot seem to find out why it won't work. I had her go to the Windows Explorer>Tools>Folder Options>View and uncheck the "Hide extensions for known file types" so that perhaps maybe that was why the macro couldn't find the file.(That didn't work either) Is it possible she may need to "re-do" the macro button itself? (I also told her NOT to have any other excel files opened when she runs the "macro" from the IS_OU_Consolidator.xls file.) sigh..... Hope this info helps

  8. #8
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Do you know that on this other user's computer, the two files are within exactly the same directory? Have you physically checked rather than taking their word for it?

  9. #9
    Registered User
    Join Date
    03-04-2010
    Location
    Wisconsin
    MS-Off Ver
    Excel 2007, Excel 2010, Excel 2003
    Posts
    87

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Quote Originally Posted by Firefly2012 View Post
    Do you know that on this other user's computer, the two files are within exactly the same directory? Have you physically checked rather than taking their word for it?
    If you look I posted (Comment #4) the image (Directory Folder image.jpg)showing that both files are in the same directory. So the answer is "Yes". Frustrating isn't it? ughhhh.... at least I am not the only one stumped!

    What about the possibility of "redoing" the macro button and "refreshing" if you will?

  10. #10
    Forum Contributor
    Join Date
    12-28-2011
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    280

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Hi Dawn

    In my testing I have found that the macro looks in the current directory for the referenced file - if the current directory has been amended eg by opening another file before running the macro then a file not found error results. Hence, I would recommend making sure the right directory is current eg like this:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-04-2010
    Location
    Wisconsin
    MS-Off Ver
    Excel 2007, Excel 2010, Excel 2003
    Posts
    87

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    Hi Firefly,

    I modified the macro per your example, sent to my end user to see if this does the trick (keep your fingers crossed!). FYI, no way I would have figured this one out on my own! While I am relatively handy with macros I still consider myself such a noob!

  12. #12
    Registered User
    Join Date
    03-04-2010
    Location
    Wisconsin
    MS-Off Ver
    Excel 2007, Excel 2010, Excel 2003
    Posts
    87

    Re: Macro button generates "run time error 1004 [FileName] could not be found' msg

    HOORAY HOORAY!!!! Just received notification that the macro change did the trick!! Firefly, I bow down before the master! Thank you so much for helping me with this. I can now "Close" the ticket!

+ 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