ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   line break character (https://www.excelbanter.com/excel-programming/422034-line-break-character.html)

joeeng

line break character
 
Why does a multiline string value from a form textbox display the linebreaks
{chr(10)} as little squares when saved to a cell? Can these little squares
be suppressed from the cell viewing by using a different ascii character for
the linebreak?

joel

line break character
 
use replace3 to remove the chr10


MyString = replace(MyString,chr(10),"")

"joeeng" wrote:

Why does a multiline string value from a form textbox display the linebreaks
{chr(10)} as little squares when saved to a cell? Can these little squares
be suppressed from the cell viewing by using a different ascii character for
the linebreak?


RadarEye

line break character
 
On 6 jan, 17:28, Joel wrote:
use replace3 to remove the chr10

MyString = replace(MyString,chr(10),"")



"joeeng" wrote:
Why does a multiline string value from a form textbox display the linebreaks
{chr(10)} as little squares when saved to a cell? *Can these little squares
be suppressed from the cell viewing by using a different ascii character for
the linebreak?- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


If you want the linebreak kept use:

MyString = replace(MyString,chr(10),vbNewLine)

HTH,

Wouter

joeeng

line break character
 

Joel,
Thanks. It turns out that the linebreak inserted in form textboxes is
chr(13) & chr(10) rather than just chr(10) and the offending character is the
chr(13). So, substituting chr(13) in your suggestion works

"Joel" wrote:

use replace3 to remove the chr10


MyString = replace(MyString,chr(10),"")

"joeeng" wrote:

Why does a multiline string value from a form textbox display the linebreaks
{chr(10)} as little squares when saved to a cell? Can these little squares
be suppressed from the cell viewing by using a different ascii character for
the linebreak?


joeeng

line break character
 

vbnewline adds a chr(13) & Chr(10)

"RadarEye" wrote:

On 6 jan, 17:28, Joel wrote:
use replace3 to remove the chr10

MyString = replace(MyString,chr(10),"")



"joeeng" wrote:
Why does a multiline string value from a form textbox display the linebreaks
{chr(10)} as little squares when saved to a cell? Can these little squares
be suppressed from the cell viewing by using a different ascii character for
the linebreak?- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


If you want the linebreak kept use:

MyString = replace(MyString,chr(10),vbNewLine)

HTH,

Wouter


JE McGimpsey

line break character
 
No, vbnewline is platform specific. For instance, on the Mac, it's the
CHR(13) character (ony).

In article ,
joeeng wrote:

vbnewline adds a chr(13) & Chr(10)



All times are GMT +1. The time now is 06:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com