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

Explain the operator precedence in vb script?

0 Answers  


how to find the textfile in the folder and copy file from one folder to another folder useing parameterigation in QTP

1 Answers   Accenture,


What are the differences between Visual Basic, VBA and VBScript? When would it be appropriate to use one as opposed to another?

1 Answers   Infosys,


What purpose does ‘on error resume next’ serves?

0 Answers  


int a=4857 i need output as 7584.without using any inbuild function?

6 Answers   Aspire,






How to identify column in VSFlexgrid? My VSFlexgrid window is identified as 'Active X Control'

0 Answers  


generic function for webedit box for web application

1 Answers  


write a vb script to display ***** ***** ***** ***** *****

4 Answers  


who you define variables and functions in VB?

1 Answers  


write a program to display configuration of a local system with the help of vb script.

0 Answers  


WHAT IS ENVIRONMENT VARIABLES?and where it is used in real time scenario?

2 Answers  


Which operator is used to perform the comparison among 2 operands in the vbscript language?

0 Answers  


Categories