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



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

Answer / 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

More VB Script Interview Questions

Which loop is used in case of arrays in the vbscript language?

0 Answers  


what is diff between static and dynaic arrys?

0 Answers  


Explain about adodb.stream class?

0 Answers  


am giving to one number u can set into that in date format.u can use any methods

1 Answers   HP,


How to generate 3 digit random number?

3 Answers   IBM, Virtusa,






A folder is there inside no of textfiles are avilable. How do count the textfiles. Normally folder means we are using subfolder methods but textfiles is not working for subfolder methods and how do get file name also.

0 Answers  


what is the standards used for writing the script in QTP

0 Answers  


Can any 1 modify the code whr in want to add\rename a excel sheet in qtp?

1 Answers  


write a vb script to rename a folder from tree4 to tree7

3 Answers  


Write program for identifyig duplicates in flight Departing from and Arriving in mercury tours(web application).

0 Answers  


What is the use of the recordset object and which statement is used to create such an object?

0 Answers  


wht must be the interview question on corinthian information technology solutions incorporated.

0 Answers   HP,


Categories