Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A little bit of experimentation and I've come up with a fairly plausible
theory: it seems as if Excel crashes as soon as it starts re-compiling the code module. I still don't know why though, and I suppose I may need that elusive patch from MS to fix it (if, indeed, there ever was one). Here's what I've figured out: 1) When I inserted code, dropped the VBProject object (and everything else beneath), and then tried to re-acquire it later on, I got a crash. Did the re-acquisition trigger a re-compilation? Well, I think it may have. 2) When I held on to the VBProject object for a little longer, I could keep on checking various properties, and things worked. However, I then exited the code generation methods, and when I re-entered it later on, and started asking for VBProjects and stuff, Excel blew up as usual. Re-compilation? Yeah, maybe... 3) When I inserted not only the event handler code but also a dummy method, everything seemed to work all right. At least until I called the dummy method hoping to trigger the re-compilation. Kaboooom! I don't think I can do much more about this issue, from the outside. I probably need to fix Excel, and not my code. So the main question, I guess, is how I'm supposed to do it... Has anyone heard anything about crashes due to on-the-fly code insertion techniques, and has anyone come across a patch from MS to fix some kind of VBE(?) critical bug? Cheers, /MP "Ivan Raiminius" wrote: Hi, I was referring the procedure you are inserting the code into. Application.run is not applicable if the procedure is called by event. I would suggest you to create a dummy sub which you will call with application.run just when finished with generating the code. It should force excel to recompile the code. I don't know the reason why excel sometimes is not able to recompile code if call is used, sorry. Regards, Ivan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
code in module A to not execute a Worksheet_SelectionChange sub of another module | Excel Discussion (Misc queries) | |||
Run worksheet module code from workbook module? | Excel Programming | |||
I am having trouble adding a row in Excel. What am i doing wrong? | Excel Worksheet Functions | |||
Adding Code to the This_workbook module of a created workbook | Excel Programming | |||
Adding Code Module to Workbook | Excel Programming |