Text1.Text="ssssssssssss aaaaaaaa→bbbb ccccccc ddddddddd→fff ggggg"Private Sub Command1_Click() Dim s As String, i As Long, sFile As String Dim sNe() As String s = Text1.Text sNe = Split(s, "→") For i = 0 To UBound(sNe) sFile = "D:\DDOWNLOAD\aa" & CStr(i) & ".txt" Open sFile For Output As #1 Print #1, sNe(i) Close #1 Next i End Sub
测试数据: ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 ”。 215415 ”。 216 ”。 ”。 ”。 ”。 215 Private Sub Command1_Click() Dim arr() As String, arr1() As String Dim i As Long, s As Long, Count As Long Dim sFile As String, Result1, Result2 As String Open "c:\1.txt" For Binary As #1 sFile = Space(LOF(1)) Get #1, , sFile Close #1
arr = Split(sFile, vbCrLf) For i = 0 To UBound(arr) Count = Count + 1 Next i
For i = 0 To Count / 2 Result1 = Result1 & arr(i) & vbCrLf Next i
For s = Count / 2 To UBound(arr) Result2 = Result2 & arr(s) & vbCrLf Next s
Open "c:\文件1.txt" For Output As #1 Print #1, Result1 Close #1
Open "c:\文件2.txt" For Output As #2 Print #2, Result2 MsgBox "数据分割完成" Close #2
End Sub
Private Sub Command1_Click() Dim arr() As String, arr1() As String Dim i As Long, s As Long, Count As Long Dim sFile As String, Result1, Result2 As String Open "c:\1.txt" For Binary As #1 sFile = Space(LOF(1)) Get #1, , sFile Close #1
arr = Split(sFile, vbCrLf) For i = 0 To UBound(arr) Count = Count + 1 Next i
For i = 0 To Format(Count / 2, "#") - 2 Result1 = Result1 & arr(i) & vbCrLf Next i
For s = Count / 2 To UBound(arr) Result2 = Result2 & arr(s) & vbCrLf Next s
Open "c:\文件1.txt" For Output As #1 Print #1, Result1 Close #1
Open "c:\文件2.txt" For Output As #2 Print #2, Result2 MsgBox "数据分割完成" Close #2
aaaaaaaa→bbbb
ccccccc
ddddddddd→fff
ggggg"Private Sub Command1_Click()
Dim s As String, i As Long, sFile As String
Dim sNe() As String
s = Text1.Text
sNe = Split(s, "→")
For i = 0 To UBound(sNe)
sFile = "D:\DDOWNLOAD\aa" & CStr(i) & ".txt"
Open sFile For Output As #1
Print #1, sNe(i)
Close #1
Next i
End Sub
”。
”。
”。 ”。 ”。 ”。 ”。
”。 ”。 ”。 ”。 ”。
”。 ”。 ”。 ”。
215415 ”。 216
”。
”。
”。
”。
215
Private Sub Command1_Click()
Dim arr() As String, arr1() As String
Dim i As Long, s As Long, Count As Long
Dim sFile As String, Result1, Result2 As String Open "c:\1.txt" For Binary As #1
sFile = Space(LOF(1))
Get #1, , sFile
Close #1
arr = Split(sFile, vbCrLf)
For i = 0 To UBound(arr)
Count = Count + 1
Next i
For i = 0 To Count / 2
Result1 = Result1 & arr(i) & vbCrLf
Next i
For s = Count / 2 To UBound(arr)
Result2 = Result2 & arr(s) & vbCrLf
Next s
Open "c:\文件1.txt" For Output As #1
Print #1, Result1
Close #1
Open "c:\文件2.txt" For Output As #2
Print #2, Result2
MsgBox "数据分割完成"
Close #2
End Sub
Private Sub Command1_Click()
Dim arr() As String, arr1() As String
Dim i As Long, s As Long, Count As Long
Dim sFile As String, Result1, Result2 As String Open "c:\1.txt" For Binary As #1
sFile = Space(LOF(1))
Get #1, , sFile
Close #1
arr = Split(sFile, vbCrLf)
For i = 0 To UBound(arr)
Count = Count + 1
Next i
For i = 0 To Format(Count / 2, "#") - 2
Result1 = Result1 & arr(i) & vbCrLf
Next i
For s = Count / 2 To UBound(arr)
Result2 = Result2 & arr(s) & vbCrLf
Next s
Open "c:\文件1.txt" For Output As #1
Print #1, Result1
Close #1
Open "c:\文件2.txt" For Output As #2
Print #2, Result2
MsgBox "数据分割完成"
Close #2
End Sub