Carriage return characture

F

Fred Kruger

I have a textbox in a userform which is called txtDetail it is set for
muliline entry and also enter key enabled.

When the contents entered in this textbox is transfered to the document a
small square is placed in from of each new line.

I know it is the carriage return symbol how do i get rid please.

cheers fred
 
H

Helmut Weber

Hi Fred,
I can't reproduce this, but anyway,
how about putting the contents of the textbox
in a string and then using replace.
As far as I see, there are only three ways
of creating a line feed in a textbox:
ctrl-return, shift-return and ctrl-shift-return,
which result in vbcrlf and vblf.
Ok, like this:

Private Sub CommandButton1_Click()
Dim s As String
s = TextBox1.Text
' s = Replace(s, vbCr, " ") ?
s = Replace(s, vbCrLf, " ")
s = Replace(s, vbLf, " ")
Selection.TypeText Text:=s
End Sub

If that doesn't help, one could built a loop
and replace any character below 32 by " ".

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top