[VBA] Get signature with photo in mail generated from Excel

roelandwatteeuw

Board Regular
Joined
Feb 20, 2015
Messages
55
Office Version
  1. 365
Platform
  1. Windows
Hi

I need to send a mail from an Excel.
A signature must be added at the end of this mail.
The signature is not the standard signature set in Outlook.
So every user added an extra (personalised) signature -Study- with the same name, so I can call this specific signature name.

So far so good.

Recently, we added a photo to this signature.

Problem: the photo can't be displayed in the generated mail.
http://i65.tinypic.com/2nv8nrr.jpg

Someone with a solution?


Code:
Sub M_CE()

Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim strSignatureFile As String
Dim strsignature As String

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
    With OutMail
    .TO = "mymail@domain.com"
    .Display
    End With
    
    strSignatureFile = CStr(Environ("USERPROFILE")) & "\AppData\Roaming\Microsoft\Signatures\Study.htm"
      strsignature = OutMail.HTMLBody
        
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    Set objTextStream = objFileSystem.OpenTextFile(strSignatureFile)
        strsignature = objTextStream.ReadAll

    strbody = "Some text"
    With OutMail
        .Subject = "My Subject"
        .HTMLBody = strbody & strsignature
    End With
End Sub
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Watch MrExcel Video

Forum statistics

Threads
1,114,443
Messages
5,547,948
Members
410,820
Latest member
Prepost
Top