Thursday, 4 June 2015

How to clear the object from memory in UFT


Where objectName refers to the object you have created earlier.

Set objectName = Nothing

Note: At the end of script we need to write above statament.

Exmple:

'Create a new Microsoft Excel object
Set myxl = createobject("excel.application")

'To make Excel visible
myxl.Application.Visible = true 
  
myxl.Workbooks.Add
wait 2

'Save the Excel file as qtp.xls
myxl.ActiveWorkbook.SaveAs  "D:\qtp.xls"
     
'close Excel
myxl.Application.Quit

Set myxl=nothing