|
-
Dec 10th, 2009, 05:14 AM
#1
Thread Starter
Evil Genius
Cannot dispose an object!!?!?!?!
I'm using a 3rd party API (in this case Quality Center OTA incase its of interest) in an Excel VBA project, and creating an object from it (TDAPIOLELib.tdconnection, which is a class, retuning an object in the documentation).
I use a "If not (thisObject is nothing) Then" statement, before running some cleanup code. At this point, the code inside of this IF statement is correctly executed & "thisObject" is not nothing.
The end of this IF block, I try to use "Set thisObject = nothing" (at this point, in a watch window I can see a whole bunch of "not connected"-type statements against each of the object's properties, however the object still very much exists (I've tried a "?Connection is nothing" call in the immediate window and successfully got a "False" value returned).
As soon as this line is executed, I get a runtime error 438, object doesn't support this property or method! Little confused here and the last thing I want is to have any memory leaks or non-disposed objects floating around having been caused by my macro/code. Help please/any suggestions/explainations?
-
Dec 10th, 2009, 05:24 AM
#2
Re: Cannot dispose an object!!?!?!?!
how are you creating the object?
you will probably need to post your code
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Dec 10th, 2009, 07:10 AM
#3
Thread Starter
Evil Genius
[Fixed] Cannot dispose an object!!?!?!?!
What a silly mistake! Thanks westconn1, pointed me in the right direction there. Just found the Connection "object" I was trying to set to nothing was a property get only, & that the actual object, a class-level variable was the one I was after (m_Connection instead).
Thanks for the tip!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|