roelandwatteeuw
Board Regular
- Joined
- Feb 20, 2015
- Messages
- 87
- Office Version
- 365
- Platform
- 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?
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