Access Memo field to Excel with Line Feeds

ejstefl

New Member
Joined
Jul 13, 2005
Messages
3
All,

I am using Access to automate Excel. I have a memo field in Access that contains Line Feeds (Ascii character 10). I am using the following command to enter the text into the cell:

wks.cells(iRow, iCol) = strData

However, I get an error when I do this. I believe this is because I have Line Feeds in the strData variable. When I replace them with Carriage Returns, the code works, but the text in Excel has boxes. I would like to retain the line feeds in Excel, similar to what would happen if I copy the text, go into Excel, hit F2, and Paste.

Can anyone help?
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
Hi ejstefl

but the text in Excel has boxes

Please check the format in that cell where you see the "boxes". It should have in the Alignment the Wrap Text option checked.

Hope this helps
PGC
 

ejstefl

New Member
Joined
Jul 13, 2005
Messages
3
Hi ejstefl

but the text in Excel has boxes

Please check the format in that cell where you see the "boxes". It should have in the Alignment the Wrap Text option checked.

Hope this helps
PGC

Hello,

When I select wrap text, I still see the boxes.

What I'd ideally like is to maintain the LF characters instead of switching them to CR. Any other ideas?
 

Watch MrExcel Video

Forum statistics

Threads
1,133,654
Messages
5,660,140
Members
418,553
Latest member
judithcatherine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top