VB中读取用:---------------------------------- Open App.Path + "\" + "Add.dir" For Input As #IntNum While Not EOF(IntNum) Input #IntNum, Strline If Trim(Strline) <> "" Then Label1.Caption = Strline Else End If Wend Close #IntNum -------------------------------------------
一次性读取:Dim fPath As String, strRlt As String fPath = "c:\test.txt" Open fPath For Binary As #1 strRlt = Space(LOF(1)) Get 1, 1, strRlt Close 1 MsgBox strRlt
在vbs中可以用FSO访问文本文件
dim fso dim txtfile set fso=createobject("scripting.filesystemobject") set txtfile=fso.opentxt("c:\www.txt")
Open App.Path + "\" + "Add.dir" For Input As #IntNum
While Not EOF(IntNum)
Input #IntNum, Strline
If Trim(Strline) <> "" Then
Label1.Caption = Strline
Else
End If
Wend
Close #IntNum
-------------------------------------------
fPath = "c:\test.txt"
Open fPath For Binary As #1
strRlt = Space(LOF(1))
Get 1, 1, strRlt
Close 1
MsgBox strRlt
dim txtfile
set fso=createobject("scripting.filesystemobject")
set txtfile=fso.opentxt("c:\www.txt")