Micro Focus QTP (UFT) Forums
how to insert value in notepad from excel - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: how to insert value in notepad from excel (/Thread-how-to-insert-value-in-notepad-from-excel)



how to insert value in notepad from excel - Thilak - 09-17-2010

Hi All,

I am trying to write a script to insert values in excel sheet which has 3 columns in it(ie column1,column2 and column3).After inserting the values need to insert those values in notepad also.

The case is
1. In excel sheet whenever we run the script only one value should be present with the updated value.
2. In notepad for each run of the script there should be separate line of values present (ie for example if we had run the script for 3 times there should be three lines in notepad)
3. The last value in the notepad should be in the excel sheet.Apart from that nothing should be there.

Could any one help me with this would be of great help to me.

Thanks in advance.

Thanks
Thilak


RE: how to insert value in notepad from excel - KavitaPriyaCR - 11-08-2010

Hi
1. In excel sheet whenever we run the script only one value should be present with the updated value.
For this you can just say:
' here update i (loop) as you want
Code:
Set objExcel=CreateObject("Excel.Application")
Set objBook=objExcel.WorkBooks.Open(("C:\path\filename1.xls")
Set objSheet=objExcel.Sheets("SheetName1")
For j= 1 To 3
objSheet.Cells(i,j).value="value"
Next
2. In notepad for each run of the script there should be separate line of values present (ie for example if we had run the script for 3 times there should be three lines in notepad)
Code:
Set fso=CreateObject("Scripting.FileSystemObject")
Set filename=fso.OpenTextFile("C:\path\filename1.txt",8,True)
'write the text here
filename.WriteLine "updating the text file"
3. 3rd point is not clear for me.