Formatting email body from Excel contents

前端 未结 2 1563
不知归路
不知归路 2021-01-14 08:41

I have a worksheet with given data,
\"enter

I need to email the data using Microso

2条回答
  •  醉话见心
    2021-01-14 09:09

    If you want to create nicely formatted Outlook emails then you need to generate emails with formatting. Pure text-based-emails are evidently not sufficient and hence you must be looking for HTML formatted emails. If that's the case you probably aim to dynamically create HTML code with your VBA to mimic the nice visual representation of Excel.

    Under the following link http://www.quackit.com/html/online-html-editor/ you'll find an online HTML editor which allows you to prepare a nicely formatted email and then shows you the HTML code which is necessary to get this formatting. Afterwards you just need to set in VBA the email body to this HTML code using

    .HTMLBody = "your HTML code here"
    

    instead of

    .Body = "pure text email without formatting"
    

    If that is not sufficient and you want to copy / paste parts of your Excel into that email then you'll have to copy parts of your Excel, save them as a picture, and then add the picture to your email (once again using HTML). If this is what you want then you'll find the solution here: Using VBA Code how to export excel worksheets as image in Excel 2003?

提交回复
热议问题