Private Sub Command2_Click()
Dim fn As Integer '文件号
Dim strRead As String '读取的内容
'获取文件号
fn = FreeFile()
'以读方式打开文件
Open "f:\test.txt" For Input As #fn
Do While Not EOF(fn)
Line Input #fn, strRead '读取一行
Debug.Print strRead
Loop
Close #fn '关闭打开的文件
End Sub
open XXX for input as #1
do while not EOF(1)
line input #1,Buf(i)
i = i + 1
loop