vb 循环按行提取TXT
展开全部
Private Sub Command1_Click()
Open "c:\1.txt" For Input As #1
Dim a() As String
Dim l As Long
While Not EOF(1)
ReDim Preserve a(0 To l) As String
Line Input #1, a(l)
l = l + 1
Wend
Close #1
Open "c:\1.txt" For Output As #1
For l = 1 To UBound(a)
Print #1, a(l)
Next l
Print #1, a(0);
Close #1
End Sub
Open "c:\1.txt" For Input As #1
Dim a() As String
Dim l As Long
While Not EOF(1)
ReDim Preserve a(0 To l) As String
Line Input #1, a(l)
l = l + 1
Wend
Close #1
Open "c:\1.txt" For Output As #1
For l = 1 To UBound(a)
Print #1, a(l)
Next l
Print #1, a(0);
Close #1
End Sub
展开全部
Dim a() As String
Dim n As Integer, i As Integer
Open "C:/1.TXT" For Input As #1
Do Until EOF(1)
n = n + 1
Loop
Close #1
ReDim a(n)
Open "C:/1.TXT" For Input As #1
For i = 1 To n
Input #1, a(i)
Next i
Close #1
Open "C:/1.TXT" For Output As #1
For i = 2 To n
Print #1, a(i)
Print
Next i
Print #1, a(1)
Close #1
Dim n As Integer, i As Integer
Open "C:/1.TXT" For Input As #1
Do Until EOF(1)
n = n + 1
Loop
Close #1
ReDim a(n)
Open "C:/1.TXT" For Input As #1
For i = 1 To n
Input #1, a(i)
Next i
Close #1
Open "C:/1.TXT" For Output As #1
For i = 2 To n
Print #1, a(i)
Next i
Print #1, a(1)
Close #1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询