Open "c:\SmallFile1.txt" For Output As fnum1
fnum2 = FreeFile
Open "c:\SmallFile2.txt" For Output As fnum2
Do While Not EOF(fnum)
Line Input #fnum, temp
temp1 = ""
For m = 1 To Len(temp)
If Mid(temp, m, 1) = "~" Then
temp1 = temp1 & ","
ElseIf Mid(temp, m, 1) = "'" Then
Else
temp1 = temp1 & Mid(temp, m, 1)
End If
Next m
If n = 1 Then
Print #fnum2, temp1
End If
If n < 3500000 Then
Print #fnum1, temp1
Else
Print #fnum2, temp1
End If
n = n + 1
Loop
Close fnum
Close fnum1
Close Fnum2
End Sub
This example works the same way as the previous one in terms of replacing characters in
the file, but there are now two output files (SmallFile1 and SmallFile2). It also has a counter
(n) to keep track of the number of rows.
310 Microsoft Access 2010 VBA Macro Programming