HI All, i am using this code to get text from a file . It works fine on small files. I am trying to read files that are 4400 lines long on average. What happens is once in while this will pickup two strings at the same time and will format the first string but will add the next line on the end of it.
As you can see i am putting this into an excel workbook which works fine and i get the same result if i use the debug window.
I haven't been able to get around this any help would be appreciated.
Open getfile For Input As fnum1
strData = Input(LOF(fnum1), fnum1)
StrLineItems() = Split(strData, vbCrLf)
Lower = LBound(StrLineItems)
Upper = UBound(StrLineItems)
Open formatfile For Output Shared As fnum2
z = 0
For i = Lower To Upper
strOut = Mid(StrLineItems(i), 3, 11) _
& Space(4) _
& Mid(StrLineItems(i), 14, 10) _
& Space(4) _
& Mid(StrLineItems(i), 23)
z = z + 1
objExcel.Activecell.Offset(z, 0) = strOut
X-)
As you can see i am putting this into an excel workbook which works fine and i get the same result if i use the debug window.
I haven't been able to get around this any help would be appreciated.
Open getfile For Input As fnum1
strData = Input(LOF(fnum1), fnum1)
StrLineItems() = Split(strData, vbCrLf)
Lower = LBound(StrLineItems)
Upper = UBound(StrLineItems)
Open formatfile For Output Shared As fnum2
z = 0
For i = Lower To Upper
strOut = Mid(StrLineItems(i), 3, 11) _
& Space(4) _
& Mid(StrLineItems(i), 14, 10) _
& Space(4) _
& Mid(StrLineItems(i), 23)
z = z + 1
objExcel.Activecell.Offset(z, 0) = strOut
X-)