Const M = 1000
Set objFSO = CreateObject("Scripting.Filesystemobject")
Set objTS = objFSO.OpenTextFile("big.txt")
intFile = 1
intLine = 1
While Not objTs.AtEndOfStream
strLine = objTS.ReadLine
If intLine Mod M = 1 Then
If IsObject(objTS2) Then objTS2.Close
Set objTS2 = objFSO.OpenTextFile("small/" & intFile & ".txt", 8, 1)
intFile = intFile + 1
End If
If intLine Mod M = 0 Then
intLine = 0
objTS2.Write strLine
Else
objTS2.WriteLine strLine
End If
intLine = intLine + 1
Wend
On Error Resume Next
objTS2.Close
Set objTs = Nothing : Set objTS2 = Nothing : Set objFSO = Nothing
Msgbox "Split complete", 0, "Codjng"
Title:
Split file by line
Description:
Const M = 1000 Set objFSO = CreateObject("Scripting.Filesystemobject") Set objTS = objFSO.OpenTextFile("big.txt") intFil...
...
Rating:
4