Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|