Tuesday, 6 July 2021

How do you get number of lines in text file using file system object in uft/qtp

--Save as same file with .txt with below code or use any other txt file and change the path of the file.

Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.OpenTextFile("D:\VB Programs\Test.txt", 8, True)
WScript.Echo "Number of lines : " &theFile.Line
Set oFso = Nothing

-Output:
Number of lines: 4

No comments:

Post a Comment