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

roelandwatteeuw

Board Regular
Joined
Feb 20, 2015
Messages
87
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
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top