VBA Excel Cells.Value不读取损坏的行

时间:2016-07-07 20:54:31

标签: excel vba excel-vba outlook outlook-vba

希望你能帮我解决这个问题。

我有一个捕获cell.value并将其带到outlook.body的宏,但是单元格的值已经直接从word复制,因此有些行不会按预期被破坏。

例如,从word文档中获取的值为:

"Hello xxx

I've been waiting for the files that you said you were going to sent

Don't forget our meeting this week.

See you
Leonardo."

但是当这个值发送到outlook.body时,会删除换行符:

"Hello xxx I've been waiting for the files that you said you were going to sent Don't forget our meeting this week. See you Leonardo."

我该怎么办?

1 个答案:

答案 0 :(得分:1)

Excel使用LF来破坏单元格中的一条线。 Outlook使用CR LF打破一条线。

尝试:

OutlookValue = Replace(ExcelValue, vbLF, vbCR & vbLF)