Excel V.X crash when executing a VBA macro

B

Bernard Baz

I'm using a "Userform" dialog box inside a VBA macro.
Excel crashes and quits whenever the size of the code attached to the
Userform reaches a certain amount (let's say 200-300 lines).
The same macro works fine under Excel 2001 (under Classic).

My configuration : G5, Panther (the same problem appers with Jaguar), Excel
V.X 10.1.5 (french language)

If anyone experiences a similar problem, please let me know.

Thanks !
 
B

Bob Greenblatt

I'm using a "Userform" dialog box inside a VBA macro.
Excel crashes and quits whenever the size of the code attached to the
Userform reaches a certain amount (let's say 200-300 lines).
The same macro works fine under Excel 2001 (under Classic).

My configuration : G5, Panther (the same problem appers with Jaguar), Excel
V.X 10.1.5 (french language)

If anyone experiences a similar problem, please let me know.

Thanks !
Something's not right! I have user forms with thousands of lines of code in
the user form. When are you seeing the problem? When does it crash? Are you
using event macros?
 
G

Guest

I agree, there's something wrong ...
The crash happens when I close the dialog box (either Cancel or OK), and
yes I have many event handlers attached to the various text boxes of the
dialog box.

I tried to isolate the problem by building a new macro containing just the
guilty userform and the attached code. I discovered that at a certain point
the userform code invokes a subroutine witch causes an other module to be
loaded, whith in turn calls an other module and so on. At the end, several
modules are loaded simultaneously in memory. Perhaps this is the reason
for the malfunction, although the total number of lines present in memory
at one time does not exceed 1000 or 2000.
Therefore, maybe I should group more efficiently the various subroutines in
order to avoid the loading of unused code .
But again the macro works perfectly under Excel 2001.
 
J

JE McGimpsey

I agree, there's something wrong ...
The crash happens when I close the dialog box (either Cancel or OK), and
yes I have many event handlers attached to the various text boxes of the
dialog box.

I tried to isolate the problem by building a new macro containing just the
guilty userform and the attached code. I discovered that at a certain point
the userform code invokes a subroutine witch causes an other module to be
loaded, whith in turn calls an other module and so on. At the end, several
modules are loaded simultaneously in memory. Perhaps this is the reason
for the malfunction, although the total number of lines present in memory
at one time does not exceed 1000 or 2000.
Therefore, maybe I should group more efficiently the various subroutines in
order to avoid the loading of unused code .
But again the macro works perfectly under Excel 2001.

A couple of thousand lines of code shouldn't tax XLv.X. Have you tried
setting breakpoints to see where to crash occurs? Or step through the
code?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top