vbCrLf problem vs Excel

F

Fredrated

I am creating queries in vba code, then using transferspreadsheet to create
Excel spreadsheets for a user that wants their data in that form.

After creating the spreadsheets I open them in vba and insert, after the
last row, a text string which lists the WHERE conditions that were in the
queries.

The problem is, if I use vbcrlf to put line feeds into the string, they show
up in the Excel cell as solid rectangles after each line. If I don't use
vbcrlf then the conditions all run together in one string.

Any idea how to insert a carrage return - line feed into the strings that is
acceptible to Excel?

Thanks for any help.

Fred
 
F

Fredrated

After posting this question I experimented with chr(10) and chr(13) and
discovered that using chr(10) by itself did the job.
 
D

Douglas J. Steele

I believe Excel only expects a Line Feed, not a Carriage Return and Line
Feed.

Try using vbLf instead (or Chr(10))
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top