none
Unexplained "File not found:" error within VBA module RRS feed

  • Question

  • I'm developing a fairly large application (~10k lines) in Excel 2010/VBA and am getting intermittent "File not found:" errors followed by Excel crashing completely.  When I trace the errors I can see that they're occurring when I'm calling one sub/function from inside another.  Sometimes the function I'm calling is literally the next function in the module.  Everything compiles fine. 

    I've discovered that making a simple change to the code (e.g., debug.print "Please work") right before the error line will often fix the problem temporarily (eventually the same thing shows up somewhere else).  I thought it might be an issue of module size so I've split up some of the larger modules so nothing is more than ~20k now.  Tried reinstalling Excel but that didn't help.  Also tried CodeCleaner (from Professional Excel Development).  

    To make things more interesting, the same file that crashes in Excel 2010 works fine in 2007.

    Anyone have any ideas?  Next step might be a complete wipe and reload but I'm hoping to avoid that.  Thanks in advance.   

    Wednesday, August 22, 2012 1:45 PM

All replies

  • Just tested the app on a different machine running 2010 and had the same issue so I doubt the wipe and reload would fix anything.  Guessing this is an issue specific to Excel 2010...
    • Edited by lwerner Wednesday, August 22, 2012 2:16 PM
    Wednesday, August 22, 2012 2:13 PM
  • Only a long shot but as you say it works sometimes with the Debug.Print line inserted I am wondering if it needs to "Catch up" and swallow what it has in its mouth before taking another bite therefore try inserting DoEvents in lieu of the Debug.Print


    Regards, OssieMac

    Thursday, August 23, 2012 4:11 AM
  • I believe this is no longer active post. But I think it might be useful to one who is having the same kind problem. Try to avoid using Dir() and open file in the same code. That is kind of crush in 2010

    Cheers

    Baha

    Tuesday, February 3, 2015 9:47 PM
  • I believe this is no longer active post. But I think it might be useful to one who is having the same kind problem. Try to avoid using Dir() and open file in the same code. That is kind of crush in 2010

    Cheers

    Baha

    To lwerner,

    Did you ever resolve your issue?

    To Baha17,

    I am always interested in extra info, particularly when there is no evidence of the issue being resolved.

    I assume you meant crash and not crush. However, I don't really understand what you are getting at so I will appreciate it if could you post a small example of code that causes the crash. (A picture is worth a thousand words and similarly with an example of code.)


    Regards, OssieMac

    Tuesday, February 3, 2015 10:56 PM