Dim TextLine
Open "TESTFILE" For Input As #1 ' 打开文件。
Do While Not EOF(1) ' 循环至文件尾。
Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。
Debug.Print TextLine ' 在立即窗口中显示数据。
Loop
Close #1 ' 关闭文件。
Open "TESTFILE" For Input As #1 ' 打开文件。
Do While Not EOF(1) ' 循环至文件尾。
Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。
Debug.Print TextLine ' 在立即窗口中显示数据。
Loop
Close #1 ' 关闭文件。
Open "文件路径及文件名" For Input As #1 ' 打开文件。
Do While Not EOF(1) ' 循环至文件尾。
Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。
Debug.Print TextLine ' 在立即窗口中显示数据。
Loop
Close #1 ' 关闭文件。以上载自MSDN