[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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Watch MrExcel Video

Forum statistics

Threads
1,109,453
Messages
5,528,856
Members
409,840
Latest member
priyanshu270
Top