PDA

View Full Version : Understand code



av8tordude
05-31-2011, 11:50 AM
What is the difference between the codes below? Please, could you explain it in simple terms. thanks.


Set objIE = Nothing

vs

objIE.quit


Thanks

Chabu
05-31-2011, 02:00 PM
objIE (or whatever reference to an object) is a pointer to an object (the address of the memory location where that object resides)

When you do Set objIE = Nothing you set that address pointer to null (you release the object because your code does not refer to that memory location anymore)

When you do objIE.quit you invoke the "quit" method on the objIE object.

I hope this helps

RonMcK
05-31-2011, 02:23 PM
Chabu,

In the second case, does objIE still exist even though the user has 'quit'?

Thanks,

Chabu
05-31-2011, 03:27 PM
That depends on what that quit method does, what object is it?

Paul_Hossler
05-31-2011, 04:40 PM
Just for safety, if I used CreateObject() to open an instance of IE, I'd set objIE to Nothing, even after a .Quit just be be sure

Paul