【问题标题】:Add image in mail body and signature in Outlook through Excel-Vba通过 Excel-Vba 在邮件正文中添加图像并在 Outlook 中添加签名
【发布时间】:2017-11-26 21:13:23
【问题描述】:

应该从我端发送的内容的图像。

我已经编写了 HTML 格式的代码,以便在邮件正文中添加一个图像,并通过函数在签名中添加另一个图像。但问题是它在我的结尾完美显示,因为我是电子邮件的发件人,但反映为红十字标记,就像他无法在指定路径找到图像一样。任何人都可以在这里帮助我为什么会发生以及如何纠正它。我附上了我在另一端收到的图像的代码和屏幕截图。

收到错误电子邮件

.HTMLBody = "<font face=""calibri"" style=""font-size:11pt;""> Dear Team," & 
            "<br> <br>" & _
            "<font face=""calibri"" style=""font-size:11pt;""> Please find 
              the attached sheet for Raw Cell Outage of " & Format$(Date, 
              "dd-mmm-yyyy") & _
        "<br><br>" & _
        "<font face=""calibri"" style=""font-size:14pt;""><b> This is based 
           on Raw Outage without validation at field end.<b>  " & _
        "<br><br>" & _
        ***"<img src='C:\Cell Outage Report MACRO\Output Data\AST_img.png'>" &_***
        "<br><br>" & _
        "<font face=""calibri"" style=""font-size:12pt;""><b><u>Thanks & 
         Regards,<b><u>" & _
        "<br>" & _
        "<font face=""calibri"" style=""font-size:15pt;""><b>Team OMC<b>" &_
        "<br>" & _
        "<font face=""calibri"" style=""font-size:15pt;""><b>B&JH<b>" & _
        "<br>" & _
        "<font face=""calibri"" style=""font-size:12pt;""><b>Contact No:- 
           0000000000<b>" & _
        "<br>" & _
        ***"<img src='C:\Cell Outage Report MACRO\Sign_logo.png'>" & _***
 [Image of the mail received at the other end][1] .HTMLBody & "</font>"   ' Adds default signature

【问题讨论】:

    标签: excel vba email outlook


    【解决方案1】:

    您需要使用Attachments.Add Method 将图像附加到邮件中。 这可以以隐藏的方式完成,因此它不会被视为附件,但仍可以以 HTML 类型的方式引用它以显示正文中的图片。使用property accessor 设置此属性。 Here 是一篇带有很好示例代码的 SO 文章。

    另一个选项是通过显示/保存邮件对象来创建邮件模板(文本、插入图像等),因为 Outlook 将为您完成所有工作(隐藏、HTML 引用等)。只需复制该邮件项目,然后根据您的需要进行调整。

    【讨论】:

    • 感谢@David G,您的建议帮助我完成了它。感谢您的努力。
    猜你喜欢
    • 1970-01-01
    • 2017-01-31
    • 2017-06-17
    • 2013-10-06
    • 1970-01-01
    • 2019-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多