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

what is the object hyrarchy in QTP for a web based application

0 Answers  


Explain vbscript in detail?

0 Answers  


hi i am trying for testing job for 3+ experience(fake) can u suggest me what type of projects i can keep in my resume and how much of knoeledge i should have abt that project.thnks in advance.urgt plz

0 Answers  


Which operator can be used to do an xor operation in vbscript?

0 Answers  


wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......

0 Answers  






Mention what is select case statement?

0 Answers  


What is select case statement?

0 Answers  


Compare java script and vb script?

0 Answers  


I have string like hp company.print tis like company hp.write a program in vbscripting

1 Answers   HP,


Difference between Function and Sub routine?

0 Answers   Polaris,


how to increase the values in text box in a given text box increament by two values by clicking on button

0 Answers  


what is extension of the file if its saved from recovery manger to some drive

1 Answers  


Categories