word vba - VBA - Can I unload stack calls to avoid a runtime 28 "Out of stack space" error? -


i'm working on project uses vba userforms assist users in creating different word documents. 1 of requirements users able go , forth between userforms.

this latest document has more userforms (31 or so) previous ones, , i've found can trigger runtime error 28 "out of stack space" populating of forms, navigating first one, going forward again.

when going forward, i'm doing nothing different first time through, believe out of stack space due limit on number of calls, rather recursive or other problem listed in microsoft documentation here https://msdn.microsoft.com/en-us/library/aa264523(v=vs.60).aspx .

for record, unloading forms when going or forward. example:

private sub cb_back_click() 'backward navigation       unload me     showpreviousform   end sub 

my question is, in vba there way can "unload" call stack?

it's extremely unlikely user did, i'm not concerned part of project, know in case other parts of project closer limit.

thanks in advance.

the way "unload" stack frame, return stack frame... or blow up.

i don't think unload me think does, , if does work intended, it's not going call stack.

the problem calling showpreviousform instead of returning caller: while "previous form" being displayed , until it's closed , execution runs end sub, call stack keeps track of position inside cb_back_click(), , until call stack unwinds, it'll stay right is.

you can observe behavior using call stack debug toolwindow.

there no programmatic way access call stack in vba. ever tried report stack trace error reporting wishes possible.

the solution not unload me , store state on form instance tells caller need go next; when end sub hit, caller can @ state value , determine do.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -