Note that this doesn't check that the file exists, make sure it does before calling the function.VB Code:
Public Function GetLineCount(Byval Filename As String) As Long Return New IO.StringReader("C:\MyTextFile.txt").ReadToEnd.Split(vbNewLine).GetUpperBound(0) + 1 End Function




Reply With Quote