Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Strange Character

I have a large TextBox in a Form, which has MultiLine set to True, and
WordWrap enabled.

When I copy the contents of this TextBox to a range in a sheet (where the
range consists of merged cells, and where Wraptext is enabled), I get
strange 'box-shaped'
characters appearing, which seem to represent where a carriage-return (enter
key) was used in the original Textbox.

Can I avoid this in some way (but still allow use of enter key in the
textbox) or, having copied the contents into the sheet range, can I then
remove them with code, please?

Regards.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Strange Character

Hi Stuart,

To have the "carriage returns" (for one of a better phrase) appear in an
Excel cell it is only necessary to have the line feed (vbLF or CHR10). The
textbox provides both a carriage return and a line feed i.e. vbCRLF or CHR13
& CHR10.

Thus, if you remove the CHR13s you should be ok. I would use something like.

myCell.value = Replace(txtBox.Value, vbCr, "")

to clean out the vbCRs.

I'm not positive you can use Replace with Excel97 so if you need to run this
on Excel 97 you can use WorksheetFunction.Replace instead of Replace.

HTH,
Gareth.


"Stuart" wrote in message
...
I have a large TextBox in a Form, which has MultiLine set to True, and
WordWrap enabled.

When I copy the contents of this TextBox to a range in a sheet (where the
range consists of merged cells, and where Wraptext is enabled), I get
strange 'box-shaped'
characters appearing, which seem to represent where a carriage-return

(enter
key) was used in the original Textbox.

Can I avoid this in some way (but still allow use of enter key in the
textbox) or, having copied the contents into the sheet range, can I then
remove them with code, please?

Regards.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Strange Character

Many thanks. It sometimes does / sometimes does not
work.

from your reply, here's what I'm using:
(in the form code, from within a With construct)
'copy Textbox contents to sheet_range
.Range("B22") = Me.TbFaxMessage.Value
'strip Cr from the range
.Range("B22").Value = Replace _
(.Range("B22").Value, vbCr, "")

Why might this not be consistent, please?

Regards.


"Gareth Roberts" wrote in message
...
Hi Stuart,

To have the "carriage returns" (for one of a better phrase) appear in an
Excel cell it is only necessary to have the line feed (vbLF or CHR10). The
textbox provides both a carriage return and a line feed i.e. vbCRLF or
CHR13
& CHR10.

Thus, if you remove the CHR13s you should be ok. I would use something
like.

myCell.value = Replace(txtBox.Value, vbCr, "")

to clean out the vbCRs.

I'm not positive you can use Replace with Excel97 so if you need to run
this
on Excel 97 you can use WorksheetFunction.Replace instead of Replace.

HTH,
Gareth.


"Stuart" wrote in message
...
I have a large TextBox in a Form, which has MultiLine set to True, and
WordWrap enabled.

When I copy the contents of this TextBox to a range in a sheet (where the
range consists of merged cells, and where Wraptext is enabled), I get
strange 'box-shaped'
characters appearing, which seem to represent where a carriage-return

(enter
key) was used in the original Textbox.

Can I avoid this in some way (but still allow use of enter key in the
textbox) or, having copied the contents into the sheet range, can I then
remove them with code, please?

Regards.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - Formatting text in cell (character by character) TomC Excel Discussion (Misc queries) 0 January 29th 10 07:25 PM
Excel-Match 1st text character in a string to a known character? bushlite Excel Worksheet Functions 2 January 15th 07 06:36 PM
Can I create a special character for the Character Map? JohnP Excel Discussion (Misc queries) 3 December 24th 06 01:10 AM
strange character B of A BDO Excel Discussion (Misc queries) 5 December 13th 06 08:40 PM
Identify strange character Stuart[_5_] Excel Programming 2 February 7th 04 02:43 PM


All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"