cutiedanger
New Member
- Joined
- Sep 17, 2014
- Messages
- 2
I am attempting to create a comma-separated text file that will be used to import data into a third-party program. The program requires that there not be carriage returns (CR) at the end of each line.
I have attempted to save as CSV (Comma delimited) (*.csv), CSV (Macintosh) (*.csv), and CSV (MS-DOS) (*.csv), but all are adding carriage returns at the end of each line.
I found this macro, but it does not seem to work either.
Is there a way to save the file as a comma delimited text file without carriage returns?
I have attempted to save as CSV (Comma delimited) (*.csv), CSV (Macintosh) (*.csv), and CSV (MS-DOS) (*.csv), but all are adding carriage returns at the end of each line.
![MDMp2Jz.png](/board/proxy.php?image=http%3A%2F%2Fi.imgur.com%2FMDMp2Jz.png&hash=9bc42440753a96e666e2887cd372d75c)
I found this macro, but it does not seem to work either.
Code:
Sub Save_As_CSV_No_CR()
Range("CJ1").Select
Dim myRng As Range
Set myRng = ActiveCell.EntireColumn
myRng.Replace What:=vbCr, Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False
Set myRng = Nothing
ChDir "C:\Users\cutiedanger\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\cutiedanger\Desktop\test-file.txt", FileFormat:=xlCSV, _
CreateBackup:=False
End Sub
Is there a way to save the file as a comma delimited text file without carriage returns?