jennifere
asked on
Deleting header lines in text file
I am writing data to an appending text file. However, each batch file that is written has a header line(these are all the same). The first header line is fine, but I don't not want any more subsequent headers after that. Here is the code I have now, but for some reason it is not deleting any of my header lines... Any suggestions or other possible solutions?
Header= <COLUMNS>|OFFICE_ID|TERMIN AL_ID|OFFI CE_NAME|PH ONE....>
Code:
Open "c:\officeOutput.txt" For Append As #2
'delete extra header lines
For i = 0 To UBound(lines)
str = lines(i)
If InStr(str, "COLUMNS") > 0 Then
lines(i) = vbNullChar
End If
Next
'uses filter to delete lines
lines = Filter(lines, vbNullChar, False)
'write data
For j = 1 To UBound(lines)
Print #2, getField(j,1) + getField(j,2)+getField(j,3 )....
Next
Close#2
Header= <COLUMNS>|OFFICE_ID|TERMIN
Code:
Open "c:\officeOutput.txt" For Append As #2
'delete extra header lines
For i = 0 To UBound(lines)
str = lines(i)
If InStr(str, "COLUMNS") > 0 Then
lines(i) = vbNullChar
End If
Next
'uses filter to delete lines
lines = Filter(lines, vbNullChar, False)
'write data
For j = 1 To UBound(lines)
Print #2, getField(j,1) + getField(j,2)+getField(j,3
Next
Close#2
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER