[RESOLVED] Problem replacing new lines...
Hello all, i thought this would be the easiest thing to do ever, i was wrong, all i want to do is replace new lines in a textbox with " " don't tell me to turn multi-line off please, i already tried that. Well, if you can supply some word wrapping code so it doesn't scroll out of view then go ahead.
Anyways, i have the following code called in a Command Button -
VB Code:
Replace Text1.Text, vbCrLf, " ", 1, -1, vbTextCompare
Which obviously doesn't work, any help ?
Thanks.
Re: Problem replacing new lines...
does VB give u an error?
the format to use Replace() is like this...
Text1 = Replace(Text1,vbcrlf," ")
you could add the vbTextCompare but in this case its not needed since there is no Upper/Lower case of vbCrLf it will find them
Re: Problem replacing new lines...
I knew i'd forgotten something, i usually start my coding off with "Option Explicit" today (well 3am last night) it seems i have forgotten it...
That should work, testing now :)
Works like a dream, cheers mate, Option Explicit also added to my coding, i recommend it :thumb: