Out of stack space

  • Thread starter Thread starter papa jonah
  • Start date Start date
P

papa jonah

I have an error that occassionally occurs when running a macro over and
over. It is "Out of stack space". It seems to go away for a little
while when I close the application and start over.

How can I prevent this? What causes it?

TIA
 
You didn't post your code but you may be calling code that recalls your code
that calls that code that recalls your code, etc. Excel get "fed up"
 
My guess is you are right. I am recalling stuff from other macros.
However, my intent is to start over everytime. Is there a way to dump
the info at the end of a run, so that the register, stack, or whatever
is clear the next time?
 
Tom Ogilvy said:
Once the macro is ended, the stack should be like new again.

Hi Tom,

Would that mean that control has to entirely transfer back to the
normal user interface from VBA?

I am thinking about the situation where an 'application' has been
built in VBA, whereby a user opens the workbook and is immediately put
into a userform menu system, where they perform various tasks, run
reports etc, and only exit from the workbook via a userform button.
Hence at no time in their use of the workbook, did they ever get to
access the workbook outside of the userform menus.

I have had an example where a user experienced stack overflow after
doing many changes to a workbook in that scenario and the only way to
resolve it seemed to be to force them out of VBA / userform control,
close and reopen the workbook.

Hope that makes sense!

Thanks,

Alan.
 
Back
Top