7,763
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command1_Click()
Dim nextline, b, c As String
Dim i, j, k, l As Integer
Open "c:\01.txt" For Input As #1
b = ""
i = 0
Do Until EOF(1)
Line Input #1, nextline
i = i + 1
If Trim(nextline) <> "" Then
b = b & nextline & vbCrLf
j = i
End If
Loop
Close #1
k = i - j
Select Case k
Case 0
b = Left(b, Len(b) - 2)
Case Is > 0
Do Until k - l = 0
c = c & vbCrLf
l = l + 1
Loop
b = Left(b, Len(b) - 2) & c
End Select
Open "c:\02.txt" For Output As #2
Print #2, b
Close #2
Kill "c:\01.txt"
Name "c:\02.txt" As "c:\01.txt"
End Sub
Private Sub Command1_Click()
Dim strTemp As String
Open "c:\1.txt" For Input As #1
Open "c:\strFile.txt" For Output As #2
While (Not EOF(1))
Line Input #1, strTemp
If Mid(Trim(strTemp), 1, 1) <> "" Then Print #2, strTemp
Wend
Close #1
Close #2
MsgBox "你的数据已保存到c:\strFile.txt中"
End Sub