Public Sub Splitter(ByVal strSourceFile As String, ByVal strDestinationPath As String, ByVal lngMaxRecordCount As Long)
Dim SourceFile As Integer
Dim DestinationFile As Integer
Dim strRecord As String
Dim lngRecordCount As Long
Dim intFileNum As Integer: intFileNum = 1
SourceFile = FreeFile()
Open strSourceFile For Input As #SourceFile
DestinationFile = FreeFile()
Open strDestinationPath & intFileNum & Right$(strSourceFile, 4) For Output As #DestinationFile
Do While Not EOF(SourceFile)
Line Input #SourceFile, strRecord
Print #DestinationFile, strRecord
lngRecordCount = lngRecordCount + 1
If lngRecordCount = lngMaxRecordCount Then
intFileNum = intFileNum + 1
lngRecordCount = 0
Close #DestinationFile
DestinationFile = FreeFile()
Open strDestinationPath & intFileNum & Right$(strSourceFile, 4) For Output As #DestinationFile
End If
Loop
Close #SourceFile
Close #DestinationFile
End Sub