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 will you get the exponent of the given number in vbscript?

792


How can you destroy an object in vbscript?

895


What is the difference between vb debugger and the script debugger?

829


Explain about the asc function?

837


Explain the adodb.stream class?

761


Explain some uses of vb script?

780


When are redim statement and preserve keyword used in the vbscript language?

837


What's the difference between vbscript and vb.net?

818


What is select case statement?

828


How to scroll down a page while recording in qtp. suggest me any method apart from low level recording.

2812


What are class properties?

897


How are arrays declared in the vbscript language?

774


what is used of Property........End Property loop ? how to write the script for it?

1947


What is the event handling in vbscript?

768


Mention how to create a cookie using vbscript?

759