简体   繁体   中英

Unable to copy the cell color from excel to outlook

I am unable to copy the entire cell format (ex. cell color) when using vba code to send emails to client using excel

在此处输入图像描述

I want to copy the cell color to outlook. The formula only let me copy the cell value only.

在此处输入图像描述

In case of HTML you need to get the required formatting from Excel objects and then set up HTML attributes (or styles) on your own.

You can also use the Word object model for copying and pasting the data with formatting. The WordEditor property returns the Microsoft Word Document Object Model of the message being displayed. The returned Word Document object provides access to most of the Word object model. See Chapter 17: Working with Item Bodies for more information.

Also be aware, the HTMLBody property in the following piece of code returns a well formed HTML document:

Signature = OutMail.HTMLBody

But later in the code you add some HTML markup before the document begins which is not correct. Even if Outlook handles such cases correctly, there is a possible mistake if the behavior is changed at some point. Keep the HTML markup well-formed inserting the content between the opening and closing <body> tags.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM