Dim TextLine Open "C:\readme.txt" For Input As #1 ' 打开文件。 Do While Not EOF(1) ' 循环至文件尾。 Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。 Debug.Print TextLine ' 在立即窗口中显示数据。 Loop Close #1 ' 关闭文件。
Open "C:\readme.txt" For binary as #1 text1.text=input(lof(1),1) Close #1
如 sektor(普通动物) 所述
楼上的方法很好,也可以用文件对象实现 Dim Wjxt As New FileSystemObject, Wj As TextStream dim getstring as string Set Wj = Wjxt.OpenTextFile("C:\readme.txt", ForReading, True) Do While wj.AtEndOfLine <> True getstring = Wj.ReadLine debug.print getstring Loop
Open "C:\readme.txt" For Input As #1 ' 打开文件。
Do While Not EOF(1) ' 循环至文件尾。
Line Input #1, TextLine ' 读入一行数据并将其赋予某变量。
Debug.Print TextLine ' 在立即窗口中显示数据。
Loop
Close #1 ' 关闭文件。
text1.text=input(lof(1),1)
Close #1
dim getstring as string
Set Wj = Wjxt.OpenTextFile("C:\readme.txt", ForReading, True)
Do While wj.AtEndOfLine <> True
getstring = Wj.ReadLine
debug.print getstring
Loop
Shell "rundll32.exe url.dll,FileProtocolHandler " & App.Path & "\123.doc", vbMinimizedNoFocus这也是高手教我的,呵呵~~