I’ve got the following code, the issue is that in the signature there is an image that won’t display at the end of the codethe error in the signature
I am looking for a solution so the image also displays. Note that when i first display the mail, the signature is complete with image.
The code is as follows:
Sub Email()
If ActiveSheet.Name <> "Status" Then
MsgBox "This macro can only be executed from the Status sheet!"
Exit Sub
End If
Application.ScreenUpdating = False
Dim Signature As Variant
Dim Overview As Variant
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim Mypath As String
Dim maillist As String
Dim rng As Range
Dim sh As Excel.Worksheet
Dim wdDoc As Word.Document
Set sh = Sheets("Status")
Set rng = sh.Range("B2:W61")
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set wdDoc = OutMail.getinspector.WordEditor
LastMember = Worksheets("Info").Cells(Rows.Count, 13).End(xlUp).Offset(0).Row
For Each cell In ActiveWorkbook.Sheets("Info").Range("M2:M" & LastMember).Cells.SpecialCells(xlCellTypeVisible)
If cell.Value Like "*" Then
maillist = maillist & ";" & cell.Value
End If
Next
Mypath = """" & ActiveWorkbook.Path & "" & ActiveWorkbook.Name & """"
strbody = "<p>Dear all,</p>" & "Please find below basware overview of today" & "<br/>" & "<A href=" & Mypath & ">Click here to open the file</A>"
On Error Resume Next
With OutMail
.display
.To = maillist
.CC = "[email protected]"
.Subject = "AP - Basware Overview - " & Date
Signature = .htmlBody
wdDoc.Range.pasteandformat Type:=wdChartPicture
With wdDoc
.inlineShapes(1).Height = 800
End With
Overview = .htmlBody & Signature
.htmlBody = strbody & Overview
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
```