How to use Text file (Notepad) as ur data source in QTP?
Can u please provide some function code for it?

Answer Posted / gp

For this you need create File system object.
Below code is for reading from text file


Const ForRead=1

Dim objFSO, objFile, strText
Set objFSO = CreateObject("Scripting.FileSystemObject")

'Reading code
Set objFile=objFSO.OpenTextFile("z:\filetext.txt", ForRead)
Do until objFile.AtEndOfStream

strText=objFile.ReadLine
msgbox strText
Loop

objFile.close

Set objFile = nothing
Set objFile1 = nothing
Set objFSO =nothing

"strText" variable will now contain data from text file.

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to Import data from a file (file is on the desktop) to the data table

1592


Does VB/Win make standalone .EXE files?

2910


What is the use of the formatdatetime function in the vbscript language?

560


What are the advantages of vbscript?

650


When does ‘on click of button’ event gets triggered in the vbscript language?

556






What are the differences between sub procedures and function procedures?

528


What is loose binding? Why is it not a good practice to use it?

641


What are the different types of loops available in the vbscript language?

538


how to check whether link is disabled in QTP??

5637


What if you do not specify anything when you call a procedure?

546


Which function is used to perform string comparison?

570


Is VB Script Case sensitive or Case insensitive?

644


How to take whole text output from screen of Bitmap Application.

1877


Mention what are the rules to name variable in vbscript?

544


Which date function is used in the vbscript language to find the difference between the 2 dates?

599