SydneyBuoy
New Member
- Joined
- Sep 9, 2019
- Messages
- 4
Unable to understand why image is not showing in the signature of the email. I have checked the image exists, the folder path is fine. The image is showing up as a dotted frame on the last line of the email. Any help would be appreciated.
Function S0N1(fldName As String, Optional FileType As String = "*.*")
Dim fName, StndrdfName, ImgPath As String
Dim sAttName, xMsg As String
Dim olApp As Outlook.Application
Dim olMsg As Outlook.MailItem
Dim olAtt, As Outlook.Attachments
Set olApp = Outlook.Application
Set olMsg = olApp.CreateItem(0) ' email
Set olAtt = olMsg.Attachments
NonStandFolder = Sheets("Bookmarks").Range("Bookmark9").Value
NonStandTemp = Sheets("Bookmarks").Range("Bookmark13").Value
FileType = NonStandTemp & ".pdf"
fName = Dir(fldName & FileType)
Do While Len(fName) > 0
olAtt.Add fldName & fName
sAttName = fName & "<br /> " & sAttName
Debug.Print fName
fName = Dir
Loop
'***************************** Path for Signature Image **********************************
ImgPath = Sheets("Email Setup").Range("Logo_Path").Value
'******************************************************* Main Email Message **************************************************************************************
xMsg = "<HTML><BODY>"
xMsg = Sheets("EmailText1").Range("EM1_L1").Value & "<br>"
xMsg = xMsg & vbNewLine & Sheets("EmailText1").Range("EM1_L2").Value & "<br>"
xMsg = xMsg & Sheets("EmailText1").Range("EM1_L3").Value & "<br>"
xMsg = xMsg & "</BODY></HTML>"
AttchFile = NonStandFolder & "\" & NonStandTemp & ".pdf"
'******************************************************* Email Details with Non Standard Attachement *******************************************************************************************
With olMsg
.Subject = Sheets("Bookmarks").Range("Bookmark14").Value
.To = Sheets("Bookmarks").Range("Bookmark3").Value
.CC = Sheets("Bookmarks").Range("Bookmark7").Value
.Attachments.Add AttchFile
.Attachments.Add ImgPath, oByValue, 0
.HTMLBody = xMsg & "<br>" & _
"<img src='" & ImgPath & "' height=50 width=100>" & .HTMLBody
.SentOnBehalfOfName = Sheets("Email Setup").Range("Bookmark15").Value
.Display
.Send
End With
Set olAtt = Nothing
Set olMsg= Nothing
Set olApp = Nothing
End Function
Function S0N1(fldName As String, Optional FileType As String = "*.*")
Dim fName, StndrdfName, ImgPath As String
Dim sAttName, xMsg As String
Dim olApp As Outlook.Application
Dim olMsg As Outlook.MailItem
Dim olAtt, As Outlook.Attachments
Set olApp = Outlook.Application
Set olMsg = olApp.CreateItem(0) ' email
Set olAtt = olMsg.Attachments
NonStandFolder = Sheets("Bookmarks").Range("Bookmark9").Value
NonStandTemp = Sheets("Bookmarks").Range("Bookmark13").Value
FileType = NonStandTemp & ".pdf"
fName = Dir(fldName & FileType)
Do While Len(fName) > 0
olAtt.Add fldName & fName
sAttName = fName & "<br /> " & sAttName
Debug.Print fName
fName = Dir
Loop
'***************************** Path for Signature Image **********************************
ImgPath = Sheets("Email Setup").Range("Logo_Path").Value
'******************************************************* Main Email Message **************************************************************************************
xMsg = "<HTML><BODY>"
xMsg = Sheets("EmailText1").Range("EM1_L1").Value & "<br>"
xMsg = xMsg & vbNewLine & Sheets("EmailText1").Range("EM1_L2").Value & "<br>"
xMsg = xMsg & Sheets("EmailText1").Range("EM1_L3").Value & "<br>"
xMsg = xMsg & "</BODY></HTML>"
AttchFile = NonStandFolder & "\" & NonStandTemp & ".pdf"
'******************************************************* Email Details with Non Standard Attachement *******************************************************************************************
With olMsg
.Subject = Sheets("Bookmarks").Range("Bookmark14").Value
.To = Sheets("Bookmarks").Range("Bookmark3").Value
.CC = Sheets("Bookmarks").Range("Bookmark7").Value
.Attachments.Add AttchFile
.Attachments.Add ImgPath, oByValue, 0
.HTMLBody = xMsg & "<br>" & _
"<img src='" & ImgPath & "' height=50 width=100>" & .HTMLBody
.SentOnBehalfOfName = Sheets("Email Setup").Range("Bookmark15").Value
.Display
.Send
End With
Set olAtt = Nothing
Set olMsg= Nothing
Set olApp = Nothing
End Function