0

I'm adding a "Send email" button to a working sheet and want to add a picture to the Outlook email. The picture is a graph which gets updated every week.

It looks like this. I guess I have to make a function somewhere in the body, wherever is suitable for the output:

Sub Create_Email()

'Define outlook variables
Dim OutApp As Object
Dim OutMail As Object

'Allocated
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

Dim NextParagraph As String

NextParagraph = vbNewLine & vbNewLine

'Inside the with box is what we send
With OutMail
    .To = "hej@hejsen.com"
    '.cc =
    '.bcc =
    .Subject = "Let us see if this will all show in the subject line"
    .Body = "Good morning everyone," & NextParagraph & "The Monday Morning Report is attached." & NextParagraph & _
                        "Comps are"
    .Display
End With
        
End Sub
Community
  • 1
  • 1
Bash
  • 1
  • 1
    Does this answer your question? [Embed picture in outlook mail body excel vba](https://stackoverflow.com/questions/44869790/embed-picture-in-outlook-mail-body-excel-vba) – braX Jul 12 '22 at 11:23

2 Answers2

0

You can use GetInspector.WordEditor to edit mail object and insert image using MS Word object model and insert picture with Shapes.AddPicture

Dim myInspector As Object
Dim wdDoc As Object
Dim myitem As Object
 
Set myitem = CreateObject("Outlook.Application").CreateItem(0)
Set myInspector = myitem.GetInspector
Set wdDoc = myInspector.WordEditor
IvanSTV
  • 242
  • 1
  • 10
0

You can save the image as file, add it as an attachment, and reference it in the HTMLBody property instead of using the plain-text Body.

See https://stackoverflow.com/a/17197140/332059

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78