|
|
Title | Count the lines in a text file |
Keywords | count lines, text file |
Categories | Files & Directories |
|
|
Read the file a line at a time and return the number of lines.
|
|
Private Function LinesInFile(ByVal file_name As String) As _
Long
Dim fnum As Integer
Dim lines As Long
Dim one_line As String
fnum = FreeFile
Open file_name For Input As #fnum
Do While Not EOF(fnum)
Line Input #fnum, one_line
lines = lines + 1
Loop
Close fnum
LinesInFile = lines
End Function
|
|
This program uses disk, directory, and file list boxes to make selecting files easy.
|
|
 |
|
|