Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am creating text files that consist of a single line of data. But once the file is complete, there is an extra "Blank" line. Is there any way to get rid of this extra blank line??
Code:
Function ExportFileSystem()
Dim counter As Long
Dim rs As New ADODB.Recordset
Dim sql As String
Dim Dpath As String
Dim Spath As String
Dim fso As New Scripting.FileSystemObject
Dim txtfile As String
Dim txtstr As TextStreamsql = "Select * from [Sample]"
counter = 1Dpath = "N:\test\"
rs.Open sql, CurrentProject.Connection
Do Until rs.EOF
'Create FLD File
txtfile = Dpath & rs("volume") & "\" & rs("NEW BATCH ID") & ".txt"
Set txtstr = fso.OpenTextFile(txtfile, ForWriting, True, TristateUseDefault)
txtstr.WriteLine rs("Site")
txtstr.Close
rs.MoveNext
Loop
rs.Close
MsgBox "done"
End Function
Problem:
The text file is all correct, but after the line from the rs("Site") there is a blank line. Making the text file two lines.Example:
SITE 'line1
'line 2 < there is a blank here. This is what i need to get rid of.

Try using txtstr.Write instead. If you find things are all jumbled on a single line after the change, you're looking at the output on a platform that does not handle MS' new line syntax well.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |