ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel v10. Extra lines printing to Text file (https://www.excelbanter.com/excel-programming/328805-excel-v10-extra-lines-printing-text-file.html)

SMS - John Howard

Excel v10. Extra lines printing to Text file
 
In using excel's Print #Num, ThisLine.
'ThisLine' is produced in VBA by concatenating each cell in a specified row.

I am getting all the data into Notepad perfectly spaced and formatted.

Trouble is I am getting an extra blank row below each line of data also.

These are having to be manually deleted prior to a batch main frame upload.

How do I suppress the extra lines.?

TIA

John Howard
Sydney, Australia



Tom Ogilvy

Excel v10. Extra lines printing to Text file
 
I ran this code with your line included and couldn't reproduce your problem.
Are you sure you aren't just seeing line wrap?

Sub AA()
Dim num As Long
Dim sStr As String
Dim ThisLine As String
num = FreeFile()
Open "C:\mytest.txt" For Output As #num
For i = 1 To 10
sStr = ""
For j = 1 To 10
If sStr = "" Then
sStr = Cells(i, j)
Else
sStr = sStr & ", " & Cells(i, j).Text
End If
Next
ThisLine = sStr
Print #num, ThisLine
Next
Close #num
End Sub

--
Regards,
Tom Ogilvy


"SMS - John Howard" wrote in message
...
In using excel's Print #Num, ThisLine.
'ThisLine' is produced in VBA by concatenating each cell in a specified

row.

I am getting all the data into Notepad perfectly spaced and formatted.

Trouble is I am getting an extra blank row below each line of data also.

These are having to be manually deleted prior to a batch main frame

upload.

How do I suppress the extra lines.?

TIA

John Howard
Sydney, Australia






All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com