Click here to Skip to main content
15,902,842 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following line of code in my project:

textline = Replace(textline, vbCrLf, "")


The point is to remove the vbCrLf from the textline string. For some reason the Replace function is ignoring the vbCrlfs and just leaving them in. Just wondering if anybody knows what I'm doing wrong and how to fix it.

I also tried:

textline = Replace(textline, Chr(13), "")
textline = Replace(textline, Chr(10), "")


That didn't work either. Any ideas?

Thanks in advance.
Posted

1 solution

Below code works for me

VB
Sub ReplaceString()

Dim textline As String

textline = "ASSDFSDF" + vbNewLine + "sdfsd"
'textline = "ASSDFSDF" + vbCrLf + "sdfsd"
textline = Replace(textline, vbCrLf, "")

MsgBox (textline)

End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900