+ Reply to Thread
Results 1 to 7 of 7

Find File out of stack space

  1. #1
    Registered User
    Join Date
    04-15-2016
    Location
    Waxahachie, TX
    MS-Off Ver
    Office 2013
    Posts
    7

    Find File out of stack space

    Greetings.
    The following is the code needed to be debugged.

    Please Login or Register  to view this content.
    This code will find the file, the problem is that it calls itself to many time. The only way I can get it to run is change FindFile(subfol.Path) to only the FindFile name. However, this builds and builds until the out of stack error is thrown.
    So I need a way, as it searches for the file, to look into the new folder for the files, and forget the previous calls on the FindFile sub. When I run it as written I get a different code that says arguments do not match.
    Any help will be greatly appreciated.

    Thanks

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Find File out of stack space

    Please show all the code for this Sub, all the way down to End Sub. Thanks.

    Also, your Sub has no arguments but you trying to call it with an argument near the bottom. This does not compile. You are getting this to run somehow but I'm not sure how you have this working.
    Last edited by 6StringJazzer; 05-25-2016 at 09:38 PM.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-15-2016
    Location
    Waxahachie, TX
    MS-Off Ver
    Office 2013
    Posts
    7

    Re: Find File out of stack space

    Here is the entire code.

    Please Login or Register  to view this content.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Find File out of stack space

    Please Login or Register  to view this content.
    This doesn't even compile. You are providing an argument here but the definition of FindFile has no arguments. How are you getting this to run at all?

  5. #5
    Registered User
    Join Date
    04-15-2016
    Location
    Waxahachie, TX
    MS-Off Ver
    Office 2013
    Posts
    7

    Re: Find File out of stack space

    The only way I can get it to run is change FindFile(subfol.Path) to only the FindFile name. However, this builds and builds until the out of stack error is thrown.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Find File out of stack space

    If we add the missing argument, you need to change the start folder from being assigned a constant to being the argument. Otherwise you are creating an infinite stack. Here is what I think this needs to look like. Often when you use recursion you have to have a Sub that starts the ball rolling:

    Please Login or Register  to view this content.
    Edit: Don't use parentheses around arguments for Sub calls unless you are using the Call keyword. I removed them.
    Last edited by 6StringJazzer; 05-26-2016 at 09:48 AM. Reason: edit as shown

  7. #7
    Registered User
    Join Date
    04-15-2016
    Location
    Waxahachie, TX
    MS-Off Ver
    Office 2013
    Posts
    7

    Re: Find File out of stack space

    Well, it appears to be working, problem is now, there is no error, but the file keeps crashing. So I am guessing it is the file set up on our network that is the issue. However,
    When I looked at the call stack, I only saw at the most 5 instances of the call.

    When I step through the code, it works, I can hold down the F8 key and it runs.

    So, not sure if there is a better way to write the code, or if it truly is just the way our files are set up.


    Thanks for your Help!
    Last edited by ljbaum; 05-26-2016 at 10:50 AM. Reason: added some thoughts

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA out of stack space
    By malcmail in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-18-2014, 07:58 AM
  2. Out of stack space
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-22-2013, 01:06 AM
  3. [SOLVED] Out of Stack Space
    By Phoenix5794 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-29-2012, 08:44 PM
  4. Out of Stack Space
    By process in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-02-2012, 11:31 AM
  5. out of stack space??
    By adds007 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 02-22-2011, 12:02 PM
  6. [SOLVED] Out of stack space
    By papa jonah in forum Excel General
    Replies: 5
    Last Post: 04-13-2005, 06:06 PM
  7. [SOLVED] Out Of Stack Space
    By Momo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2005, 11:06 AM
  8. Out Of Stack Space
    By ianripping in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2005, 10:47 AM

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