Monday, 28 November 2011

How to Copy data from one Excel Sheet 2 another using QTP

Well if you wanna copy data from one excel to other using QTP, then below is the solution for your prob:
Dim vin ,vin_ws
Set Excl_obj = CreateObject(“Excel.Application”)
obj.Visible = True
Set vin_Workbook1= Excl_obj.Workbooks.Open(“C:\1.xls”)
Set vin_Workbook2= Excl_obj.Workbooks.Open(“C:\2.xls”)
Set vin_ws =objWorkbook2.Worksheets(“Sheet1″)
vin_Workbook1.Worksheets(“Sheet1″).UsedRange.Copy
vin_Workbook2.Worksheets(“Sheet1″).Range(“vin”).PasteSpecial Paste =xlValues
vin_Workbook1.save
vin_Workbook2.save
vin_Workbook1.close
vin_Workbook2.close
set Excl_obj=nothing
*****************

No comments:

Post a Comment