用VB获取一个文本文档的行数

怎样用VB获取一个文本文档的行数

第1个回答  2010-05-11
函数为
Function Rows(xPath As String) As Long
Dim temp As String
Rows = 0
Open xPath For Input As #1
Do Until EOF(1)
Line Input #1, temp
Rows = Rows + 1
Loop
Close #1
End Function
调用方法
Private Sub Command1_Click()
MsgBox Rows("c:\1.txt")
End Sub本回答被提问者采纳
相似回答