I've got a problem when using the Write I/O command.
The original file has data without any Text Qualifiers.
However when I write the data to a new file, it's written WITH the Text Qualifier " surrounding each row/line.
For example:
Original File:
line1
line2
...
Written file:
"line1"
"line2"
...
Does anyone knows how to stop this?
My code is:
Public Sub CreateMergedFile()
Dim strHeaderFile As String
Dim strMainFile As String
Dim strFooterFile As String
Dim strOutputFile As String
Dim lngHeaderFileNum As Long
Dim lngMainFileNum As Long
Dim lngFooterFileNum As Long
Dim lngOutputFileNum As Long
Dim strLine As Variant
strHeaderFile = "i:\BBDRV_Header.txt"
strMainFile = "i:\STDERIVEDFI.out"
strFooterFile = "i:\BBDRV_Footer.txt"
strOutputFile = "i:\stderivedfi_test.txt"
lngOutputFileNum = FreeFile
Open strOutputFile For Output Access Write As #lngOutputFileNum
' Header
lngHeaderFileNum = FreeFile
Open strHeaderFile For Input As #lngHeaderFileNum
Do While Not EOF(lngHeaderFileNum)
Input #lngHeaderFileNum, strLine
If StrComp(strLine, "IGNORETHIS|ISIN|", vbTextCompare) = 0 Then
' do nothing, ie. ignore it
Else
Write #lngOutputFileNum, strLine
End If
Loop
Close #lngHeaderFileNum
' Main
lngMainFileNum = FreeFile
Open strMainFile For Input As #lngMainFileNum
Do While Not EOF(lngMainFileNum)
Input #lngMainFileNum, strLine
Write #lngOutputFileNum, strLine
Loop
Close #lngMainFileNum
' Footer
lngFooterFileNum = FreeFile
Open strFooterFile For Input As #lngFooterFileNum
Do While Not EOF(lngFooterFileNum)
Input #lngFooterFileNum, strLine
Write #lngOutputFileNum, strLine
Loop
Close #lngFooterFileNum
Close #lngOutputFileNum
End Sub
Bookmarks