In Notepad we can get Count of lines with the following code. But it works fine for less than 100 kb size of Text files.
Const ForReading = 1, ForWriting = 2
Dim fso, MyFile,a, intLine
' Create Object
Set fso = CreateObject("Scripting.FileSystemObject")
' Open the file for reading
Set MyFile = fso.OpenTextFile("C:\SPQTP.txt", ForReading,True)
while(MyFile.atendofline<>true) 'read the file to the end of file
sLine=MyFile.readline()'line by line reading
n = n + 1 'increment counter
msgbox "Text :- " &sLine
Wend
msgbox "Number of lines in the text file:- "& n
' Close the file
MyFile.Close
Monday, February 16, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment