I have this code to parse through a text file. The parsing works great, but I have one minor problem.... some of the fields may start with zeros, and the output is dropping them.... how do I get the output to print exactly what is in the input file????
Thanks in advance for your help!!!
Option Explicit
Private Sub cmdProcess_Click()
'declare variables
Dim lngCount As Long
Dim buff, tmpText, myarray() As String
'open files
Open "C:\inputfile.txt" For Input As #1
Open "C:\outputfile.txt" For Output As #2
'process file
Do While Not EOF(1)
Line Input #1, buff
myarray = Split(Mid(buff, 8, 100), ",", -1)
For lngCount = 0 To UBound(myarray)
Print #2, Mid(buff, 1, 8) & myarray(lngCount)
Next
Loop
'close records
Close #2
Close #1
'notify when process is complete
MsgBox "Finished Processing Files", vbOKOnly
End Sub
Thanks in advance for your help!!!
Option Explicit
Private Sub cmdProcess_Click()
'declare variables
Dim lngCount As Long
Dim buff, tmpText, myarray() As String
'open files
Open "C:\inputfile.txt" For Input As #1
Open "C:\outputfile.txt" For Output As #2
'process file
Do While Not EOF(1)
Line Input #1, buff
myarray = Split(Mid(buff, 8, 100), ",", -1)
For lngCount = 0 To UBound(myarray)
Print #2, Mid(buff, 1, 8) & myarray(lngCount)
Next
Loop
'close records
Close #2
Close #1
'notify when process is complete
MsgBox "Finished Processing Files", vbOKOnly
End Sub