【问题标题】:Attaching an Outlook email item and an excel workbook into my email将 Outlook 电子邮件项目和 Excel 工作簿附加到我的电子邮件中
【发布时间】:2020-06-10 02:06:46
【问题描述】:

我已经编写了附加 Excel 工作簿的代码。我只需要将电子邮件项目附加到电子邮件中的代码..请协助

【问题讨论】:

标签: excel vba outlook


【解决方案1】:

尝试以下代码(根据您的要求更改工作表名称和范围)

Sub Mail()
Dim r As Range
Set r = Worksheets("to_Mail").Range("A1:AD69")
r.Copy
Dim OutApp As Object
    Dim outMail As Object
    Set OutApp = CreateObject("Outlook.Application")
    Set outMail = OutApp.CreateItem(0)
On Error Resume Next
    With outMail
    .HTMLBody = activeMailMessage.HTMLBody
        .To = ""
        .CC = ""
        .BCC = ""
        .Subject = "Report Complete"
  Dim wordDoc As Word.document
Set wordDoc = outMail.GetInspector.WordEditor

wordDoc.Range.PasteAndFormat wdChartPicture
outMail.send
End With
End Sub

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-21
    • 1970-01-01
    • 1970-01-01
    • 2017-07-20
    • 2019-06-05
    • 2019-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多