Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with destruction)

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default Managing objects in VBA ( specifically good practices with destruc

Check out the key word "Nothing", example: Set Object = Nothing

"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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Managing objects in VBA ( specifically good practices with destruc

when object var goes out of the scope [fe after returning from the sub that
has created it] does it also mean that referenced object is properly removed
from memory [assuming that was the last refernece to that object]?


"Jim May" je napisao u poruci interesnoj
...
Check out the key word "Nothing", example: Set Object = Nothing

"Tom Med" wrote:



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Managing objects in VBA ( specifically good practices with destruction)

Could you describe the "instability"?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Tom Med" wrote in message
oups.com...
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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Managing objects in VBA ( specifically good practices with destruction)

Look at this thread of 26 Sept 2007:
VBA6 cores when hitting Reset button on the VBA IDE

RBS

"Jon Peltier" wrote in message
...
Could you describe the "instability"?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Tom Med" wrote in message
oups.com...
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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with destruc

Yup I have already done that, I have also cleared down any member
variables of classes in the terminate method. I am looking for
something that will explain how vba manages objects, or will show me
the internals of what vba is doing with all my objects


On 27 Sep, 12:17, Jim May wrote:
Check out the key word "Nothing", example: Set Object = Nothing

"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



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with destruction)

Sure. When I try and close a certain workbook and hence VBAProject I
get a coredump. When I try to stop the VBE execution in this project
I get a core dump. When I try and compile this project I get a core
dump. Due to the nature of these problems it is hard to narrow it
down from a project level. Although I am trying to run the modules in
this project separately to see if I can locate the exact cause.

Thanks


On 27 Sep, 13:06, "Jon Peltier"
wrote:
Could you describe the "instability"?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

"Tom Med" wrote in message

oups.com...

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



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with destruction)

And I have now discovered it crashes when I try to remove a module or
class.... so basically it is impossible to debug too.

I have updated to the latest vbe6.dll I could find on the MS website
and done everything else I know how to do and am totally out of ideas
now

On 27 Sep, 13:30, Tom Med wrote:
Sure. When I try and close a certain workbook and hence VBAProject I
get a coredump. When I try to stop the VBE execution in this project
I get a core dump. When I try and compile this project I get a core
dump. Due to the nature of these problems it is hard to narrow it
down from a project level. Although I am trying to run the modules in
this project separately to see if I can locate the exact cause.

Thanks

On 27 Sep, 13:06, "Jon Peltier"
wrote:

Could you describe the "instability"?


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______


"Tom Med" wrote in message


roups.com...


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



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Managing objects in VBA ( specifically good practices with destruc

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


  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Managing objects in VBA ( specifically good practices with destruc

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





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Managing objects in VBA ( specifically good practices with des

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




  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Managing objects in VBA ( specifically good practices with des

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





  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with des


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



  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Managing objects in VBA ( specifically good practices with des

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




  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with des

I am trying to create a version that is portable ( i.e. emailable)
but still exposes the bug

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





  #16   Report Post  
Posted to microsoft.public.excel.programming
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



  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Managing objects in VBA ( specifically good practices with des

Looks you are making progress.
Just remember to force Option Explicit from now on as explained.

RBS


"Tom Med" wrote in message
ups.com...
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




  #18   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Managing objects in VBA ( specifically good practices with destruction)

If I encountered something like this, I would suspect some kind of
corruption. Sure, it's a lousy excuse for not knowing what's wrong, but
whatever.

I would copy the code from each module into my text editor and save a pile
of text files. I would rebuild the problematic project bit by bit to make
sure it's not a simple coding error (though I usually make complicated
errors <g). I'd go through and compile often to try to see where the
problem creeps in.

Other than this kind of brute force rebuilding of the project, I'm not sure
what to suggest.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Tom Med" wrote in message
ups.com...
And I have now discovered it crashes when I try to remove a module or
class.... so basically it is impossible to debug too.

I have updated to the latest vbe6.dll I could find on the MS website
and done everything else I know how to do and am totally out of ideas
now

On 27 Sep, 13:30, Tom Med wrote:
Sure. When I try and close a certain workbook and hence VBAProject I
get a coredump. When I try to stop the VBE execution in this project
I get a core dump. When I try and compile this project I get a core
dump. Due to the nature of these problems it is hard to narrow it
down from a project level. Although I am trying to run the modules in
this project separately to see if I can locate the exact cause.

Thanks

On 27 Sep, 13:06, "Jon Peltier"
wrote:

Could you describe the "instability"?


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______


"Tom Med" wrote in message


roups.com...


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





  #19   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Managing objects in VBA ( specifically good practices with destruc

Except the OP claims that removing a module crashes Excel. The code cleaner
sequentially removes all the modules, saves the project, then adds the
modules back in.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"RB Smissaert" wrote in message
...
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





  #20   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Managing objects in VBA ( specifically good practices with destruc

Maybe have a go with Andrew Baker's Workbook Rebuilder.
This has the options to recover of repair workbooks and this does more than
the code cleaner. It is not free software, but worth the small fee:
http://www.vbusers.com/commercial/commercial.asp

RBS


"Jon Peltier" wrote in message
...
Except the OP claims that removing a module crashes Excel. The code
cleaner sequentially removes all the modules, saves the project, then adds
the modules back in.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"RB Smissaert" wrote in message
...
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








  #21   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Managing objects in VBA ( specifically good practices with destruction)

This was going to be my last resort. The problem is that there are
lots of cross dependencies to other addin's ( both VBA and c++ ) so I
would have to try to replace these connections/dependancies with dummy
function calls. All of which takes a very long time. I found one
class full of un Dimmed vars ( not mine I hasten to add ) so I am not
sure if it was that causing some under the covers VBA craziness. The
Explicit seems to have fixed it when the moving to a new sheet did
not. Have had no crashes yet today, so I am assuming that is the
issue

Tom

On 28 Sep, 14:16, "Jon Peltier"
wrote:
If I encountered something like this, I would suspect some kind of
corruption. Sure, it's a lousy excuse for not knowing what's wrong, but
whatever.

I would copy the code from each module into my text editor and save a pile
of text files. I would rebuild the problematic project bit by bit to make
sure it's not a simple coding error (though I usually make complicated
errors <g). I'd go through and compile often to try to see where the
problem creeps in.

Other than this kind of brute force rebuilding of the project, I'm not sure
what to suggest.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______

"Tom Med" wrote in message

ups.com...

And I have now discovered it crashes when I try to remove a module or
class.... so basically it is impossible to debug too.


I have updated to the latest vbe6.dll I could find on the MS website
and done everything else I know how to do and am totally out of ideas
now


On 27 Sep, 13:30, Tom Med wrote:
Sure. When I try and close a certain workbook and hence VBAProject I
get a coredump. When I try to stop the VBE execution in this project
I get a core dump. When I try and compile this project I get a core
dump. Due to the nature of these problems it is hard to narrow it
down from a project level. Although I am trying to run the modules in
this project separately to see if I can locate the exact cause.


Thanks


On 27 Sep, 13:06, "Jon Peltier"
wrote:


Could you describe the "instability"?


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -http://PeltierTech.com
_______


"Tom Med" wrote in message


roups.com...


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



Reply
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
And in case I don't see you,good afternoon,good evening,and good n msnyc07 Excel Discussion (Misc queries) 1 June 1st 10 11:24 AM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good davegb Excel Programming 1 May 6th 05 06:35 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 23 April 23rd 05 09:26 PM
Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good you [email protected] Excel Programming 0 April 22nd 05 03:30 PM
How can I avoid form destruction?? Dag Johansen Excel Programming 0 August 27th 03 09:03 AM


All times are GMT +1. The time now is 07:40 PM.

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

About Us

"It's about Microsoft Excel"