Email Signature

csweet

New Member
Joined
Aug 21, 2018
Messages
2
Can anyone help i have peaced together the below code through using Google and a bit of trial and error, I have created a macro to send an email based on data in a spread sheet. My problem is the email signature does not display the pictures can anyone help? see below code

Dim xOutApp As Object
Dim xOutMail As Object
Dim xMailBody As String
Dim Signature As String
Dim xAccount As Object
On Error Resume Next

Set xOutApp = CreateObject("Outlook.Application")
Set xOutMail = xOutApp.CreateItem(0)

Signature = Environ("appdata") & "\Microsoft\Signatures"
If Dir(Signature, vbDirectory) <> vbNullString Then
Signature = Signature & Dir$(Signature & "*.htm")
Else:
Signature = ""
End If
Signature = CreateObject("Scripting.FileSystemObject").GetFile(Signature).OpenAsTextStream(1, -2).ReadAll

xMailBody = "Dear " & Range("L2") & "," & "
" & "
" & _
Range("C2") & " " & Range("B2") & " - " & Range("A2") & "Text" & "
" & "
" & _
"text" & Range("C2") & "text" & "
" & "
" & _
"Text" & Range("C2") & "text" & "
" & "
" & _
"Text" & "
" & "
" & _
"Kind Regards," & "
" & "
" & _
"name" & "
" & _
"Job title" & "
" & "
"

On Error Resume Next

With xOutMail
.To = Range("N2")
.CC = ""
.BCC = ""
.Subject = "Subject"
.HTMLBody = xMailBody & Signature
Set .SendUsingAccount = xOutApp.Session.Accounts.Item(2)
.Display

End With
On Error GoTo 0
Set xOutMail = Nothing
Set xOutApp = Nothing

Rows("2:2").Delete

End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

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