0
我想要一个宏来发送excel文档作为Outlook中电子邮件的正文。我试着录制一个宏并发送它,但没有写任何代码。我将创建一个批处理文件,该文件将在预定时间打开excel,并且我希望我在excel中运行的程序能够发送标签“Assembly”“Lam”“Finish”和“MW”作为电子邮件的正文在展望。这甚至有可能吗?Excel VBA发送电子邮件
我想要一个宏来发送excel文档作为Outlook中电子邮件的正文。我试着录制一个宏并发送它,但没有写任何代码。我将创建一个批处理文件,该文件将在预定时间打开excel,并且我希望我在excel中运行的程序能够发送标签“Assembly”“Lam”“Finish”和“MW”作为电子邮件的正文在展望。这甚至有可能吗?Excel VBA发送电子邮件
A quick google搜索会走很长的路。
请参见:How to send a range of cells in an e-mail message by using Visual Basic for Applications in Excel
下面是相关的VBA代码。
Sub Send_Range()
' Select the range of cells on the active worksheet.
ActiveSheet.Range("A1:B5").Select
' Show the envelope on the ActiveWorkbook.
ActiveWorkbook.EnvelopeVisible = True
' Set the optional introduction field thats adds
' some header text to the email body. It also sets
' the To and Subject lines. Finally the message
' is sent.
With ActiveSheet.MailEnvelope
.Introduction = "This is a sample worksheet."
.Item.To = "E-Mail_Address_Here"
.Item.Subject = "My subject"
.Item.Send
End With
End Sub
为您的特定情况下,你将不得不修改上面的代码中选择所有单元格为每个4张 - 在一个循环"Assembly"
"Lam"
"Finish"
和"MV"
然后贴到电子邮件正文中。
这是,你可以开始修改找到的代码[在http://www.rondebruin.nl](http://www.rondebruin.nl/win/s1/outlook/bmail6.htm) – user2140261