Dim TextLine Open "TESTFILE" For Input As #1 ' 打开文件。 Do While Not EOF(1) ' 循环至文件尾。 Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。 Debug.Print TextLine ' 在立即窗口中显示数据。 Loop Close #1 ' 关闭文件。
Dim strS As String Open "f:\d.txt" For Binary As 1 strS = String(FileLen("f:\d.txt"), " ") Get #1, , strS Close #1 temp = Split(strS, vbCrLf) string1 = temp(0) string2 = temp(1)
Open "TESTFILE" For Input As #1 ' 打开文件。
Do While Not EOF(1) ' 循环至文件尾。
Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。
Debug.Print TextLine ' 在立即窗口中显示数据。
Loop
Close #1 ' 关闭文件。
Open "f:\d.txt" For Binary As 1
strS = String(FileLen("f:\d.txt"), " ")
Get #1, , strS
Close #1 temp = Split(strS, vbCrLf)
string1 = temp(0)
string2 = temp(1)