PDA

View Full Version : Eliminating carriage return character



mejohnst
08-27-2008, 02:51 PM
I have a userform with a textbox set to EnterKeyBehavior True, MultiLine True, and WordWrap True, which I determined from various forums would enable my users to hit enter within the textbox to create multiple lines of text. These lines of text appear in a field in the document; however, there is a carriage return character that appears at the beginning of each new line of text. This character looks like a rectangular box.

Right now the only way to get rid of these boxes is to manually delete them in the document. Does anyone know how I can get rid of the boxes automatically, or to keep them from appearing in the first place?

Thanks!

macropod
08-27-2008, 09:21 PM
Hi mejonst,

You can eliminate this with, of all things:
Private Sub CommandButton1_Click()
ActiveDocument.FormFields("Text1").Result = Replace(TextBox1.Text, vbCrLf, vbCr)
Application.ScreenRefresh
End Sub

mejohnst
08-28-2008, 08:47 AM
Worked like a charm! Thank you!!