Try something like this, you will have to format the outout to the files and play around with the number of characters in each text file:
Private Sub Command1_Click()
'Path/filename of original file
Open "C:/break/original.txt" For Input As #1
'Variables
Dim intLength As Double 'Length of files
Dim intCounter As Integer 'Counter for unique filenames
Dim strLine As String 'One line from master file
Dim strOutput As String 'Line of output
'reset vars
intLength = 0
intCounter = 1
strOutput = ""
'Loop till EOF(master)
While Not EOF(1)
'Get next line
Line Input #1, strLine
strOutput = strOutput & strLine
'record length of line
intLength = intLength & Len(strLine)
If intLength > 1024 Then
'If number of characters in output file exceeds a certain number then produce output
Open "C:/break/" & intCounter & ".txt" For Output As #2
Print #2, strOutput
Close #2
'Reset vars
intLength = 0
intCounter = intCounter + 1
strOutput = ""
End If
Wend
End Sub
Enter your message below
Sign in or Join us (it's free).