Control char that will force CR in Excel when exported.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following statement in a Access Module and it will be used to
export into Excel. In Excel in you can press Alt Return to show a CR within a
cell and I want to do the same here, i.e. I want to add a control charater to
the ed of this statement which when it exports to Excel will force a CR in
the cell.

Merge = Merge + F_Date + " " + F_UpdateFrom + " " + F_Comments + " "

Any ideas?
 
Chr(10) is the character that you seek (it's the LineFeed character).

Merge = Merge + F_Date + " " + F_UpdateFrom + " " + F_Comments + " " +
Chr(10)

Note that your expression above will be "negated" if any of the fields
contain a Null value, meaning that the output will be nothing. Use &
concatentation operator instead of + operator:

Merge = Merge & F_Date & " " & F_UpdateFrom & " " & F_Comments & " " &
Chr(10)
 
The text, i.e. when the text goes into Excel the color of the text is black,
and if possible I would like it to be blue for some of the cell.
 
That cannot be done using ACCESS's built-in exporting methods. That can be
done only by opening the EXCEL file after the export is done (use Automation
to open the file) and then using VBA to change the font of some of the text
in a cell.
 
Back
Top