简体   繁体   English

如何通过Excel在电子邮件的正文中发送多个范围?

[英]How to send multiple ranges in the body of an email through Excel?

I want to create a macro to generate an email to send out by sending two separate ranges from an xlsm file. 我想创建一个宏,以通过从xlsm文件发送两个单独的范围来生成要发送的电子邮件。 I've used Ron De Bruin's code from here : https://msdn.microsoft.com/en-us/library/ff519602(v=office.11).aspx 我从这里使用Ron De Bruin的代码: https ://msdn.microsoft.com/zh-cn/library/ff519602( v= office.11​​).aspx

Specifically the range to html function and the mail selection range outlook body macro. 特别是html功能范围和邮件选择范围Outlook主体宏。 However, I am very new to Excel vba and programming in general, and so I don't know how to modify this code in order to paste two selections of cells rather than just one. 但是,我一般对Excel vba和编程都不熟悉,所以我不知道如何修改此代码以粘贴两个单元格而不是一个单元格。 The format I would like for the email is: Good morning, 我想要的电子邮件格式为:早上好,

Text 1 文字1

Range 1 范围1

Text 2 文字2

Range 2 范围2

Thanks. 谢谢。

Can any of you please help me with this? 你们任何人都可以帮我吗? Thank you. 谢谢。

.HTMLBody = "Good morning,"
.HTMLBody = .HTMLBody & "Text 1"
.HTMLBody = .HTMLBody & RangetoHTML(range1)
.HTMLBody = .HTMLBody & "Text 2"
.HTMLBody = .HTMLBody & RangetoHTML(range2)
.HTMLBody = .HTMLBody & "Thanks."

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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