MrExcel Publishing
Your One Stop for Excel Tips & Solutions

.txt-export - select whole workbook and mark each row

Posted by Alex Kerste on October 26, 2000 5:23 AM

Thanks to
A large part of my problem with exporting an excelfile from Excel 97 to a .csv-File automatically it has already been solved by you, thanks.
Yet, I've still got two more problems:

How do I select the whole workbook and
Is there a way to put some special character or entry (lets say "EndOfLine!") at the end of every row of the original worksheet?

This is the code I currently use:

Sub AlsTextSpeichern()
Dim MyRg As Range
Dim TextCell As Range
Dim TxtToWrite As String

Set MyRg = Range("a1:J155")
For Each TextCell In MyRg
TxtToWrite = TxtToWrite & TextCell.Text & Chr(124)
Open "C:\Test.txt" For Output As #1
Print #1, TxtToWrite
Close #1

End Sub

Thank you,

Posted by Ivan Moala on October 27, 2000 5:24 AM

I beleive Chip Pearsons site has what you require
so rather then recreating the wheel have a look @


Posted by Alex Kerste on October 31, 2000 7:28 AM

Thanks for the link, it's nearly exactly what I was looking for.