We all know how to count number of lines in a text file. We can use any one of the below methods to do that.
- Incrementing a counter variable while reading or skipping a line using File System Object (FSO).
- Read all the content using FSO-ReadAll method, split it line by line and put into an array.
- Read the content and count no. of lines using RegExp.
'Storing File path in strFilePath variable
'Creating object for .Net IO File class
'Counting no. of lines using Length after reading all the lines using ReadAllLines method