PDA

View Full Version : Running out of stack space....



Thymen
03-06-2006, 02:04 PM
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

mdmackillop
03-06-2006, 02:20 PM
Not sure about stack space, but have a look at Info in the help file for some memory data.

Norie
03-06-2006, 02:35 PM
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.

Thymen
03-06-2006, 02:43 PM
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?! :bug:

Thymen

XLGibbs
03-06-2006, 04:44 PM
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...

Norie
03-06-2006, 09:48 PM
80 pages of code?

Why?

Thymen
03-07-2006, 10:53 AM
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.... :bow:

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. :friends:

Thymen

Killian
03-07-2006, 01:41 PM
Thanks for sharing the story wth us, Thymen. It's nice to get some detail about VBA in it's natural habitat! :thumb
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 :yes