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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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