PC Review


Reply
Thread Tools Rate Thread

Compiled Application Crashes

 
 
onlyng@gmail.com
Guest
Posts: n/a
 
      9th Jan 2008
Symptom: Compiled application crashes while same uncompiled
application works OK.
Platform: XL 2003 on winXP

I have an XL application with about 150 Subs and 1500 lines of code.
All the subs are accessed via a custom CommandBar, created by code.
It has been working fine for a long time.

Recently, I made a small update, involving some cells and just one
sub. I compiled and saved the application.
The application started crashing, when another sub was called - not
the modified one.

To my surprise, I discovered, that if I saved the application without
compiling it, it works!

I tried VBA Code Cleaner, and same pattern persists. The compiled
version crashes while the uncompiled version works.

Any idea?


Thanks
Dovy
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      9th Jan 2008
There is very little benefit to compiling code in VBA. Normally compiled code
will run faster but not in VBA. What compiling does however is it increases
the file size. So your compiled file will take longer to load since it is
marginally larger but it will not run any faster. Take a look at this site
where you can get a decomipler utility...

http://cpap.com.br/orlando/VBADecompilerMore.asp
--
HTH...

Jim Thomlinson


"(E-Mail Removed)" wrote:

> Symptom: Compiled application crashes while same uncompiled
> application works OK.
> Platform: XL 2003 on winXP
>
> I have an XL application with about 150 Subs and 1500 lines of code.
> All the subs are accessed via a custom CommandBar, created by code.
> It has been working fine for a long time.
>
> Recently, I made a small update, involving some cells and just one
> sub. I compiled and saved the application.
> The application started crashing, when another sub was called - not
> the modified one.
>
> To my surprise, I discovered, that if I saved the application without
> compiling it, it works!
>
> I tried VBA Code Cleaner, and same pattern persists. The compiled
> version crashes while the uncompiled version works.
>
> Any idea?
>
>
> Thanks
> Dovy
>

 
Reply With Quote
 
onlyng@gmail.com
Guest
Posts: n/a
 
      10th Jan 2008
On Jan 9, 6:24*pm, Jim Thomlinson <James_Thomlin...@owfg-Re-Move-
This-.com> wrote:
> There is very little benefit to compiling code in VBA. Normally compiled code
> will run faster but not in VBA. What compiling does however is it increases
> the file size. So your compiled file will take longer to load since it is
> marginally larger but it will not run any faster. Take a look at this site
> where you can get a decomipler utility...
>
> http://cpap.com.br/orlando/VBADecompilerMore.asp
> --
> HTH...
>
> Jim Thomlinson
>
>
>
> "onl...@gmail.com" wrote:
> > Symptom: Compiled application crashes while same uncompiled
> > application works OK.
> > Platform: XL 2003 on winXP

>
> > I have an XL application with about 150 Subs and 1500 lines of code.
> > All the subs are accessed via a custom CommandBar, created by code.
> > It has been working fine for a long time.

>
> > Recently, I made a small update, involving some cells and just one
> > sub. I compiled and saved the application.
> > The application started crashing, when another sub was called - not
> > the modified one.

>
> > To my surprise, I discovered, that if I saved the application without
> > compiling it, it works!

>
> > I tried VBA Code Cleaner, and same pattern persists. The compiled
> > version crashes while the uncompiled version works.

>
> > Any idea?

>
> > Thanks
> > Dovy- Hide quoted text -

>
> - Show quoted text -


Thanks Jim
I read with interest your reference, but I have another experience
which is in favor of compilation. It has nothing to do with time
saving, rather with crash avoiding.

I experienced frequent crashes with another application (>350 Subs,
>4000 lines of code).

The application creates custom CommandBar on Workbook_Open and cashed
often (but not always), when one of the menu items was used.
(Attempting to open a csv data file to import data).

I found an ugly workaround which eliminated the crashes: after
launching the app, I used a menu item to expose XL normal worksheet
CommandBar, than saved the app without any changes. Then I switched
back to the custom CommandBar and worked normally. This is an
application I work with on a daily basis (always on same machine), and
I had the habit of compiling after any code change. I kept following
this hated and time consuming procedure for a long time, until I
discovered by chance that sometimes, the application opened in an
uncompiled state (the compile menu item was enabled), even though I
compiled it before saving and closing.

At this point, I added the following code to Workbook_Open, and I have
not experienced one single crash ever since. (There is no more need to
re-save the app immediately after opening).

Sub Compile()

With Application.VBE.CommandBars.FindControl(ID:=578)
If .Enabled = True Then .Execute
End With

End Sub

It appears that the compiling issue in VBA has more than one aspect to
it.

Thanks
Dovy
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Console application will only run on machine where application was compiled rlemon27@gmail.com Microsoft Dot NET Framework 8 4th Apr 2007 03:53 PM
Excel crashes if project is not compiled (urgent help please!) Jos Vens Microsoft Excel Programming 4 20th Mar 2006 08:43 PM
Beta 2 compiled executable throwing "The application failed to initialize properly (0xc0150002). Click OK to terminate this application." Gustavo L. Fabro Microsoft VC .NET 3 20th May 2005 06:59 PM
know when im application was compiled Daylor Microsoft VB .NET 1 19th Jan 2004 08:17 PM
way to know when my application was compiled Daylor Microsoft Dot NET 1 19th Jan 2004 11:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:00 PM.