07-13-2013, 12:59 PM
There are syntax errors in your code -
Use this -
Use this -
Code:
Dim obj_FSO, my_objFile, text_FilePath
Dim Obj_Excel, Excel_Filename, Excel_SheetName, Excel_Row, Excel_Col, v
text_FilePath = "C:\sample.txt"
Set obj_FSO = createObject("Scripting.FileSystemObject")
Set my_objFile = obj_FSO.OpenTextFile(text_FilePath, 8)
Excel_FileName = "C:\Book1.xls"
Excel_SheetName = "Sheet1"
Excel_Col =1
Set Obj_Excel = CreateObject("Excel.Application")
Obj_Excel.Workbooks.Open Excel_FileName
For i= 1 to 3
Excel_Row =1
v= Obj_Excel.ActiveWorkBook.Worksheets(Excel_SheetName).Cells(Excel_Row, Excel_Col)
my_objFile.WriteLine v
Next
Obj_Excel.ActiveWorkbook.save
Obj_Excel.ActiveWorkbook.Close
Obj_Excel.Workbooks.Close
Obj_Excel.Application.Quit
Set Obj_Excel = Nothing
'Wscript.Quit
my_objFile.Close
Want to fast track your QTP/UFT Learning? Join our UFT Training Course