Here is a macro that opens the text file and writes new parts with 20000
rows each in it. Those are written to the C:\Temp folder, shange to fit your
needs. You can of course also change 20000 to another number if you want
more / fewer rows in each file.
Sub SplitTextFile()
Dim F As Variant
Dim ToRead As String
Dim ToWrite As String
Dim ReadLine As String
Dim L As Long, M As Long
Dim iOne As Integer
Dim iTwo As Integer
F = Application.GetOpenFilename
If F = False Then Exit Sub
ToRead = CStr(F)
iOne = FreeFile
Open ToRead For Input As #iOne
L = 1
ToWrite = "C:\Temp\Part" & Format$(L, "00000000") & ".txt"
iTwo = FreeFile
Application.StatusBar = "Writing " & ToWrite
Open ToWrite For Output As #iTwo
While Not EOF(iOne)
Line Input #iOne, ReadLine
M = M + 1
If M > 20000 Then
Close #iTwo
DoEvents
L = L + 1
ToWrite = "C:\Temp\Part" & _
Format$(L, "00000000") & ".txt"
Application.StatusBar = "Writing " & ToWrite
Open ToWrite For Output As #iTwo
M = 0
End If
Print #iTwo, ReadLine
Wend
Close #iOne
Close #iTwo
Application.StatusBar = False
MsgBox L & " parts written"
End Sub
HTH. Best wishes Harald