vb中怎样读聚txt文档中指定一行数据

来源:百度知道 编辑:UC知道 时间:2024/04/18 15:15:48
有什么好的办法!请高手指教!

简单一点就这样 根据需要自行修改

Private Sub Form_click()
MsgBox RText("d:\1.txt", 3)
End Sub

Function RText(ByVal Tpath As String, y As Long) As String
Open Tpath For Input As #1
Do While Not EOF(1)
Line Input #1, temp
x = x + 1
If x = y Then RText = temp: Exit Function
Loop
Close #1
End Function