• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1260
  • Last Modified:

Export to Excel: vbCrlf

Hi,
whenever i export data from, for example a textbox with multiline enabled, to MS Excel, it will show me squares in the excel sheet for each vbCrlf there was in the textbox.

Here's an example of the code:

*********
xlSht.Cells(3, 1).Value =  txtRoot(1).Text
*********

Assuming the txtRoot(1) has this data in it:
26578
3246
3444

Then it wil show a square after each number once it is inside a cell in Excel.

How to trap this? (and replace by ALT + ENTER ?)

cheers
Ricky
0
Paurths
Asked:
Paurths
  • 2
1 Solution
 
PaulHewsCommented:
lSht.Cells(3, 1).Value =  Replace(txtRoot(1).Text, vbCrLf, vbLf)
0
 
PaulHewsCommented:
It chokes on a carriage return, so the trick is to just use a line feed.
0
 
PaurthsAuthor Commented:
Thanks Paul,
seeing it i am somewhat ashamed lol,
i can't believe i looked over vbLf...

thanks again,
cheers
Ricky
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now