View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
Tom Med Tom Med is offline
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with des

I have had partial success manually removing all the VBA errors due to
"Option Explicit" by exporting to file then changing and re-
importing. It now does not crash when it closes or compiles, it
sometimes crashes when you stop debuging too, but I cannot reproduce
this reliably yet.

When I can reproduce another reliable crash I will post a
selfcontained example

Thanks very much for your help, I feel like I have half broken its
back with the Option Explicit, that was a good suggestion

Thanks
Tom

On 27 Sep, 18:54, "RB Smissaert"
wrote:
Just post the wb and I will have a look.
Obviously no guarantee I can make it work.
Should the wb work by itself or are there any external
libraries other than the standard VBA ones?

RBS

"Tom Med" wrote in message

ups.com...



Sorry for the delayed response, I had to demo something. I have moved
all my code across to an old stable version of the sheet and put in
'explicit' everywhere. However I am still getting a core in VBA when
I try to compile ( in the proces of finding all the compile errors
from "Option Explicit". At the moment I am trying recreate this on
another sheet that was created from blank, but I getting errors trying
to reference my other add ins I need to compile the code.


It is hard to narrow this down to a code extract I can give John as
all I get is a fatal exception


On 27 Sep, 16:26, "RB Smissaert"
wrote:
Would that make a difference?
I use the commercial Workbook Rebuilder and I think that does make
a new wb, but not sure.


This thread reminds me of a thread some years ago, started by a Belgium,
who
had a large commercial .xla that was messed up in a similar way.
Eventually we got it working again.


I wonder if it wouldn't be better if Option Explicit was added by default
to every component, so you would need to do Don't require variable
declaration to not have this. It sure would avoid a lot of trouble.


RBS


"Tom Ogilvy" wrote in message


...


Basically, but the code cleaner doesn't move it to another workbook.


--
Regards,
Tom Ogilvy


"RB Smissaert" wrote:


That is basically the same as running the VBA Code Cleaner, but a lot
more
work.


RBS


"John.Greenan" wrote in
message
...
Hi Tom,


You have posted a few questions about this instability. No-one
reading
can
really provide a comprehensive answer since we've got no
understanding
of
what you are doing. People can provide a few pointers but it's very
hard
to
help when you cannot see the code.


My "code unseen" tip - create a new workbook and cut and paste all
of
your
VBA into there then re-compile.


--
http://www.alignment-systems.com


"Tom Med" wrote:


I am having a lot of problems with VBA instability at the moment.
And
I am pretty sure this is to do with the destruction of objects and
their deletion from memory. I get this instability everytime I try
to
stop the VBA or to close certain workbooks. Does anyone have any
information or resources about how VBA manages it objects? Or does
anyone know what known problems there are with certain types of
object
that could cause instabilities? Sort of like the C# problem with
structs vs classes. Are there certain things I should to to ensure
the clean removal of objects within classes?


Thanks
Tom