MisterChips
New member
- Local time
- Today, 00:17
- Joined
- Oct 13, 2022
- Messages
- 11
I have managed to achieve the above as long as I use an actual path (Please excuse me if my terminology isn't exact).
However, If I try to use a string, I cannot get it to work.
I have tried as many combinations of " and "" and '. as I can think of, without luck.
This is the code I have been using:-
Private Sub Command13_Click()
Dim strEmailAddress As String
Dim appOutlook As Outlook.Application: Set appOutlook = New Outlook.Application
Dim mimEmail As Outlook.MailItem
Dim strImageFullPath
Dim att As Outlook.Attachment
Set mimEmail = appOutlook.CreateItem(olMailItem)
strEmailAddress = "dave@lllllll.co.uk"
strImageFullPath = "C:\PGCO\Supporting_the_2025_Festival.jpg"
Set att = mimEmail.Attachments.Add(strImageFullPath, 1, 0)
With mimEmail
.To = strEmailAddress
.Subject = "2025 Festival"
' #####################
'.HTMLBody = "<img src=""C:\PGCO\Supporting_the_2025_Festival.jpg""></html>" ' WHY DOES THIS WORK
.HTMLBody = "<img src=strImageFullPath></html>" ' WHILST THIS DOESN'T?
' #####################
.Display
End With
End Sub
I have also added the above as a file.
What syntax do I need to make the lower .HTMLBody line work?
Any advice that can be given will be well received.
However, If I try to use a string, I cannot get it to work.
I have tried as many combinations of " and "" and '. as I can think of, without luck.
This is the code I have been using:-
Private Sub Command13_Click()
Dim strEmailAddress As String
Dim appOutlook As Outlook.Application: Set appOutlook = New Outlook.Application
Dim mimEmail As Outlook.MailItem
Dim strImageFullPath
Dim att As Outlook.Attachment
Set mimEmail = appOutlook.CreateItem(olMailItem)
strEmailAddress = "dave@lllllll.co.uk"
strImageFullPath = "C:\PGCO\Supporting_the_2025_Festival.jpg"
Set att = mimEmail.Attachments.Add(strImageFullPath, 1, 0)
With mimEmail
.To = strEmailAddress
.Subject = "2025 Festival"
' #####################
'.HTMLBody = "<img src=""C:\PGCO\Supporting_the_2025_Festival.jpg""></html>" ' WHY DOES THIS WORK
.HTMLBody = "<img src=strImageFullPath></html>" ' WHILST THIS DOESN'T?
' #####################
.Display
End With
End Sub
I have also added the above as a file.
What syntax do I need to make the lower .HTMLBody line work?
Any advice that can be given will be well received.