Mutli-line text box outputting funny characters

cbrf23

Board Regular
Joined
Jun 20, 2011
Messages
241
I have a text box on a form for adding notes to the form.

The text box is set up so that hitting enter while typing inside it adds a carriage return. Enter behavior and multiline are set to True.

When I tested things at home, on excel 2010, hitting enter while typing in the textbox resulted in a carriage return/line feed, and when the text box data was entered into a cell it was the same as dislplayed. Perfect, exactly what I want.

But, when I got to work this morning, excel 2003, I found that if I type in my textbox and hit enter, I get multiple lines in the textbox that look fine. BUT, when the string is output to a cell, i get a carriage return but the last character of the line (before the carriage return) is a funny little square character...

Whats the deal? And does anyone know how to fix this?

I tried to paste the text from excel into this post, but the squares didnt display....
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I found the solution in another thread here.

Seems that the little square was indeed the chr(13) symbol. I did not know that.

This solution works, but I dont really understand why I was getting those symbols in the first place. (using font arial, fontstyle normal, size 12)

In my code, I replaced:
Code:
strNote = Me.txtNote.Text 'txtNote is the name of my textbox...
with
Code:
strNote = Replace(Me.txtNote.Text, vbCrLf, vbLf)
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,267
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top