Consulting

Results 1 to 8 of 8

Thread: Running out of stack space....

  1. #1
    VBAX Regular
    Joined
    Jan 2006
    Posts
    30
    Location

    Running out of stack space....

    Hi folks;

    In the office I use Office XP, at home I use Office 2000. I take work home a lot. But now, with the heavily coded workbook I work on I have run out of stack space on my home system. Error 028. I immediately admit that the code can be more efficient. I have planned for a clean-up, but preferrably not now......

    Is there anything "simple" I can do to clear up stack memory? Any way I can figure out the stack space left? How about the difference between Office 2000/XP?

    Thymen

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Not sure about stack space, but have a look at Info in the help file for some memory data.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Thymen

    Can you post the code?

    One way of running out of stack space is if you are calling code recursively.

    That might be what you want to do but then again it might not be.

  4. #4
    VBAX Regular
    Joined
    Jan 2006
    Posts
    30
    Location
    Quote Originally Posted by Norie
    Can you post the code.
    hmmmm.... cannot post for two reasons:

    1- this workbooks requirers some other workbooks that contain sensitive data

    2- all together about 80 pages of code, plus about 20 forms....

    Guess #2 explains perhaps why I run out of stack space, huh?!

    Thymen

  5. #5
    VBAX Master XLGibbs's Avatar
    Joined
    Jan 2006
    Location
    state of confusion, but vacation in denial
    Posts
    1,315
    Location
    Stack space is a not directly a memory issue. There is too much happening within one stored procedure. This can include calling multiple subroutines from within another, and is not specifically a memory problem, however, if code routines and events are endlessly triggering themselves, this error will occur.

    If you have a lot of forms, which in turn write to a lot of sheets, this can cause a lot of erroneous triggering of many events which would cause the error.

    The problem is not memory, but a programming snafu...
    If you have posted the same question at multiple forums, please read this IMPORTANT INFO.

    Please use the thread tools to mark your thread Solved


    Please review the Knowledge Base
    for samples and solutions , or to submit your own!




  6. #6
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    80 pages of code?

    Why?

  7. #7
    VBAX Regular
    Joined
    Jan 2006
    Posts
    30
    Location
    Quote Originally Posted by Norie
    80 pages of code? Why?
    Why not? I know there are many different ways of doing things, and many different objectives to be met.
    I am an engineer, not a programmer. My objective it to visualize an information routing process through our company, where all departments one after the other add/revise/comment on each others bits and pieces of information.

    Using VBA/Excel came from the fact that some data was already available in Excel, and because I and everybody else have it on our computers.

    I admit it kind of grew larger then I thought possible at first. But.... that is mostly because VBA / Excel allowed it. I have divided the project up into several "problem areas", decided on how they should interface, and got started with one after the other. Now, six weeks later, I have a tool that works except for some minor items to be added, and I can explain to the people in a very visual way the process of information routing through our company.

    Had we decided to get started with "real" programmers, we would get stuck. The problem is the info routing process, not the program itself. In the next few weeks people will be able to play around with the tools, comment on it, and allow us to refine the process. Once that has been done, we may decide to hand the entire stuff over to "real" programmers. And if they decide it is better to use either Access, Java, C++, VBA....

    And, to conclude,...... there was a memory-eating glitch in my code.. I found it, and solved it.... thanks to some directions I got here.

    Thymen

  8. #8
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location

    Thumbs up

    Thanks for sharing the story wth us, Thymen. It's nice to get some detail about VBA in it's natural habitat!
    It sounds like quite an eloborate example that looks like fulfilling an important objective. I think you chose a good route to designing a solution.

    Hopefully you know where to come if you need any help on taking it further or maintaining and tweaking what you have
    K :-)

Posting Permissions

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