0

I'm writing some logs entries into a csv file however when I'm trying to replace CR and LF into a specific string I'm getting the same result as before.

Replace(SQLStatement, vbTab & Chr$(13) & Chr$(10), "")

Not being able to remove CR and LF, and even Tabs, is affecting my csv and finally in the Excel file the string is outputed on more lines instead of just one.

1 Answer 1

2

That will only replace the specific combination of vbTab & Chr$(13) & Chr$(10).

If you want to replace them you will need to do the individually.

Replace(Replace(Replace(SQLStatement, vbTab,""), Chr$(13),""), Chr$(10), "")

Although you need to be careful that your lines do not run into one another. You might be safer with

Replace(Replace(Replace(SQLStatement, vbTab," "), Chr$(13)," "), Chr$(10), " ")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.