
VBAで
・テキストファイルの行数を取得
できます!
VBAコード
ここでは例として、
・デスクトップ配下のファイル「aiueo.txt」の
・行数を取得
します。

Option Explicit
Sub sample()
Dim fso As Object
Dim fileName As String
Dim lineCount As Long
'ファイルのパスを指定
fileName = "C:\Users\user\Desktop\aiueo.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
'ファイルの行数を取得
lineCount = fso.OpenTextFile(fileName:=fileName, iomode:=8).Line
MsgBox "ファイルの行数は「" & lineCount & "」です。"
'後片付け
Set fso = Nothing
End Sub
実行結果
テキストファイルの行数を取得できました。

参考①
上記のVBAコードで使用した以下の詳細は、公式サイトをご確認ください。
●「FileSystemObject」の「OpenTextFile」メソッド
●「TextStreamオブジェクト」の「Lineプロパティ」
参考②
PDFファイルやWordファイルのページ数を取得することもできます。
詳細は以下の記事をご確認ください。
●PDFファイルのページ数を取得
●Wordファイルのページ数を取得