vb依次读取程序同一目录下a.txt文件每行为一个变量的实现

来源:百度知道 编辑:UC知道 时间:2024/06/07 01:53:10
vb依次读取程序同一目录下a.txt文件每行的内容为一个变量 应该怎么实现

Open App.Path & "\a.txt" For Input As #1
Dim Lstr As String
Do While Not EOF(1)
Line Input #1, Lstr
text1 = text1 & Lstr & vbCrLf
Loop
Close #1

最简单的就是用myArray()
然后用一个for next循环和ReDim Preserve myArray()
使得每个元素和每一行一一对应.
很简单的.