Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check if the Object is Empty/Null
#2
Solved: 11 Years, 4 Months, 2 Weeks ago Shy 
Hi,
I myself found the solution.
* We set an Object to Nothing i.e Set Object = Nothing
* Now we need to Check if the variable 'Object' is 'Null/Empty'
* Here we cannot use IsNull/IsEmpty/IsObject because all returns True even if the 'Object' is 'Null/Empty'
* Hence the solution is

Code:
Set oNothing = Nothing
'Set an Object i.e oNothing to Nothing

Set Object = CreateObject("Excel.Application")
Set Object = Nothing

If oNothing Is Object = True Then
    Msgbox "Object is Nothing"
Else
    Msgbox "Object has some values"
End If

Compare the two objects 'oNothing' and 'Object' using the Is condition
If both the values are true the result is met.
Reply


Messages In This Thread
RE: Check if the Object is Empty/Null - by manojith1984 - 05-20-2009, 10:44 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to force QTP to Check for trigger through Recovery Object ? Sumit Maru 0 3,235 02-21-2011, 02:44 PM
Last Post: Sumit Maru
  How to check visibility of an Object ritugoyal 4 11,175 08-03-2009, 03:39 PM
Last Post: Ankur
  QTP 9.5 Object Repository merge tool not merging the Check Point objects govqa 0 3,312 05-18-2009, 07:11 PM
Last Post: govqa
  How to check an object is NOT there? alecjcook 2 3,257 05-13-2008, 02:10 AM
Last Post: niranjan

Forum Jump:


Users browsing this thread: 1 Guest(s)