LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Trouble Adding VBA Code to Module; Bug in Excel/VBE?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
Run worksheet module code from workbook module? keithb Excel Programming 1 August 14th 05 04:04 AM
I am having trouble adding a row in Excel. What am i doing wrong? Glendie Excel Worksheet Functions 1 May 28th 05 08:37 PM
Adding Code to the This_workbook module of a created workbook RPIJG[_68_] Excel Programming 1 July 9th 04 06:35 PM
Adding Code Module to Workbook Charles Excel Programming 2 January 6th 04 08:43 AM


All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"