Hi,
I have a macro which works and displays the email along with the signature. However, I have tried including an image within the signature but when I run the macro, it simply just gives the dreaded red cross as if it can't be shown. The image is a simple jpg and I can't seem to get my head round why.
Below is the code for my email macro: -
Sub Email()
Dim OutApp As Object
Dim OutMail As Object
Dim strHTMLbody As String
Dim dtimeStamp As String
Dim SigString As String
Dim Signature As String
Dim ToDate As String
Dim FromDate As String
FromDate = Format(Now - 10, "dd/mm/yyyy")
ToDate = Format(Now - 1, "dd/mm/yyyy")
dtimeStamp = Format(Now, "yyyymmdd")
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strHTMLbody = "<font size=""3"" face=""Calibri"">" & _
"Hi ,<br><br>" & _
"Please find data for the following dates <b>" & FromDate & " - " & ToDate & "<br></B>" & _
"<br>" & _
"Cloick on the attached link for the latest file" & _
"<A HREF=""internal hyperlink" & _
""">here</A>" & _
"</B><br>" & _
"<br><br></font>"
SigString = Environ("appdata") & _
"\Microsoft\Signatures\signature.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
.to = "joe.bloggs@email.net"
.CC = ""
.BCC = ""
.Subject = ""
.HTMLBody = strHTMLbody & "<br>" & Signature
.Display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Function GetBoiler(ByVal sFile As String) As String
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
As I said I am at a loss as to why the image would not appear in the signature.
Any help would be fantastic.
Thanks,
Andrew Cropper
Bookmarks