hrolsons
asked on
Trying to get rid of hard return in text
So I have a program that writes out a text file. Everything is working fine, but I need to get rid of any hard returns before writing to the text file. I tried:
txtText1=replace(txtText1, vbCrLf,"<P >")
But I'm still ending up with hard returns in the final file.
Any ideas?
txtText1=replace(txtText1,
But I'm still ending up with hard returns in the final file.
Any ideas?
Note also, that your input data does not necessarily have both a new line and a carriage return to delimit the records. Some environments use only one, so your Replace() wouldn't then be appropriate.
ASKER
Here is the code that I'm using:
intFileHandle = FreeFile
Open App.Path & "\myfile.csv" For Append As #intFileHandle
Print #intFileHandle, myStr
Close #intFileHandle
The print-command appends a newline. Try using the put-command instead, then you can specify exact what to write.
Dennis
Dennis
You can use a Put statement. For that you must have opened the output file for Binary or Random.
However, judging by the file extension of .csv, you need a normally delimited text file.
If you are trying to add something to each line of a CSV file, just append the new text to the original text line and output each line as a whole.
However, judging by the file extension of .csv, you need a normally delimited text file.
If you are trying to add something to each line of a CSV file, just append the new text to the original text line and output each line as a whole.
ASKER
It looks like what it's missing is a LF only. Would I look for it using it's ASCII?
vbLf is the Virtual Basic constant name
The ASCII value is 10 (decimal)
ASKER
I tried vbLf and it didn't get rid of the darn thing.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
What method are you using to write to the output file?