Hello All,
I am needing help getting an output file in the correct format. My input file(.txt) has 3 fields. The fields are delimited by tabs, but the 3rd field has ranges and numbers seperated by commas.
ie. (very small sample)
rm ##98S 1234,3456,5678
rm ##233 345-678,679
I need to print out a file like this
rm ##98S 1234
rm ##98S 3456
rm ##98S 5678
rm ##233 345-678
rm ##233 679
I am able to parse through and break on the commas, but am unsure how to reprint the first 2 fields??? Here is the code I am using and the results:
results:
rm ##98S 1234
3456
5678
rm ##233 345-678
679
Any ideas out there?
Thanks in advance!
I am needing help getting an output file in the correct format. My input file(.txt) has 3 fields. The fields are delimited by tabs, but the 3rd field has ranges and numbers seperated by commas.
ie. (very small sample)
rm ##98S 1234,3456,5678
rm ##233 345-678,679
I need to print out a file like this
rm ##98S 1234
rm ##98S 3456
rm ##98S 5678
rm ##233 345-678
rm ##233 679
I am able to parse through and break on the commas, but am unsure how to reprint the first 2 fields??? Here is the code I am using and the results:
Code:
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(buff, ",", -1)
For lngCount = 0 To UBound(myarray)
Print #2, myarray(lngCount)
Next
Loop
'close records
Close #2
Close #1
'notify when process is complete
MsgBox "Finished Processing Files", vbOKOnly
End Sub
results:
rm ##98S 1234
3456
5678
rm ##233 345-678
679
Any ideas out there?
Thanks in advance!