dim a() as string dim str as string redim a(0) open file do unitl eof(filenumber) redim preserve a(ubound(a)+1) line input filenumber, str a(ubound(a)-1)=str loop close file
Dim fsoTxt As New FileSystemObject, tsTxt As TextStream Dim i As Integer Dim J As Integer
Set tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading) tsTxt.ReadAll J = tsTxt.Line tsTxt.CloseSet tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading) For i = 0 To J - 1 a(i) = tsTxt.ReadLine NexttsTxt.Close
Dim a() As String Dim str As String Dim fn As LongReDim a(0) fn = FreeFile Open App.Path + "\aa.txt" For Input As #fnDo Until EOF(fn) ReDim Preserve a(UBound(a) + 1) Line Input #fn, str a(UBound(a) - 1) = str Loop Close #fn这个也是可以的。
dim str as string
redim a(0)
open file
do unitl eof(filenumber)
redim preserve a(ubound(a)+1)
line input filenumber, str
a(ubound(a)-1)=str
loop
close file
Dim i As Integer
Dim J As Integer
Set tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading)
tsTxt.ReadAll
J = tsTxt.Line
tsTxt.CloseSet tsTxt = fsoTxt.OpenTextFile(AppfileName, ForReading)
For i = 0 To J - 1
a(i) = tsTxt.ReadLine
NexttsTxt.Close
Dim str As String
Dim fn As LongReDim a(0)
fn = FreeFile
Open App.Path + "\aa.txt" For Input As #fnDo Until EOF(fn)
ReDim Preserve a(UBound(a) + 1)
Line Input #fn, str
a(UBound(a) - 1) = str
Loop
Close #fn这个也是可以的。