I'm trying to create an Excel VBA, but my Outlook signature never shows. I want to add an image to my email body and had to use "HTMLbody", but then nothing worked. I tried to reset my computer, add a code to replicate a default signature of another email for this VBA.
This is my code:
Option Explicit
Sub enviar_email()
Dim intervalo As Range
Dim grafico As ChartObject
Dim Email As Object
Set intervalo = Sheet7.Range("A19:V54")
intervalo.CopyPicture
Set grafico = Sheet7.ChartObjects.Add(intervalo.Left, intervalo.Top, intervalo.Width, intervalo.Height)
With grafico
.Activate
.Chart.Paste
.Chart.Export Environ$("temp") & "/grafico.jpg"
.Delete
End With
Set Email = CreateObject("Outlook.application").createitem(0)
With Email
.to = "pradi@outlook.com"
.cc = "pradir@gmail.com"
.Subject = "MRP SEMANAL W" & Cells(28, 25)
.attachments.Add Environ$("temp") & "/grafico.jpg", 1, 0
.HTMLbody = "Bom dia time!" & "<br>" & "<br>" & _
"Segue abaixo o Mrp Semanal referente a W" & Cells(28, 25) & "<br>" & "<br>" & _
"<img src='cid:grafico.jpg'>" & "<br>" & "<br>" & _
"Obrigado." & "<br>" & "<br>"
.display
End With
End Sub
Can someone help me understand why it's not working?