![]() |
How to test if an object exist really
Hie,
I try (unsuccesfully to test if an object of my own is "Nothing" or not I created an object class, let's call it MyClass. Thren I declared an instance of this variable like this: Dim MyObj as new MyClass Dim boTest as boolean Set MyObj = Nothing boTest = MyObj Is Nothing Strangely, boTest is false! (I hoped this test retrun was true) The question is : where did I make a mistake. Thanks for your help. -- Jean-Pierre Bidon Interstat 91 rue de Rennes 75006 Paris Tél: 01 45 49 19 17 |
How to test if an object exist really
Try:
Dim MyObj As myClass Dim boTest As Boolean Set MyObj = New myClass Set MyObj = Nothing boTest = MyObj Is Nothing And then read Chip Pearson's explanation: http://www.cpearson.com/excel/variables.htm Look for: Don't Use The New Keyword In A Dim Statement Jean-Pierre Bidon wrote: Hie, I try (unsuccesfully to test if an object of my own is "Nothing" or not I created an object class, let's call it MyClass. Thren I declared an instance of this variable like this: Dim MyObj as new MyClass Dim boTest as boolean Set MyObj = Nothing boTest = MyObj Is Nothing Strangely, boTest is false! (I hoped this test retrun was true) The question is : where did I make a mistake. Thanks for your help. -- Jean-Pierre Bidon Interstat 91 rue de Rennes 75006 Paris Tél: 01 45 49 19 17 -- Dave Peterson |
How to test if an object exist really
Instead of
Dim MyObj as new MyClass use Dim MyObj as MyClass "Jean-Pierre Bidon" wrote: Hie, I try (unsuccesfully to test if an object of my own is "Nothing" or not I created an object class, let's call it MyClass. Thren I declared an instance of this variable like this: Dim MyObj as new MyClass Dim boTest as boolean Set MyObj = Nothing boTest = MyObj Is Nothing Strangely, boTest is false! (I hoped this test retrun was true) The question is : where did I make a mistake. Thanks for your help. -- Jean-Pierre Bidon Interstat 91 rue de Rennes 75006 Paris Tél: 01 45 49 19 17 |
All times are GMT +1. The time now is 02:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com