I've found this question asked a few times on the forum, but in almost all cases it was never answered and in the others I can't follow the explanation given
This is the code I currently use to automatically generate emails and it works just fine.
What i would like to is to embed an image, based on a filepath stored as part of the value set for str_Body. I've tried setting str_Body to the following.
This works fine within the local team, as everyone has access to the folder in which the JPG is stored. Sending the same mail outside the department doesn't work, dut to the recipient not having access to the same folder.
Does anyone know an easy way to amend the above - either the HTML part or the VBA itself - such that I can send an image which anyone can read.
In case it makes a difference, all recipients will be using Outlook for their email.
Thanks in advance.
This is the code I currently use to automatically generate emails and it works just fine.
Code:
Sub Email_IA()
Dim NameSpace As Object
Dim EmailSend As MailItem
Dim EmailApp As Object
Dim str_Source_Path As String
Dim str_Subject As String
Dim str_Body As String
Dim str_To As String
Dim str_From As String
str_Subject = "Test Subject"
str_Body = DLookup("Body", "tbl_Email_Bodies", "Email_Type = 112")
str_To = IIf(IsNull([Forms]![frm_referral_from]![Received from Email]), "", [Forms]![frm_referral_from]![Received from Email])
Set EmailApp = CreateObject("Outlook.Application")
Set objeoutlookmsg = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)
EmailSend.BodyFormat = olFormatHTML
EmailSend.To = str_To
EmailSend.Subject = str_Subject
EmailSend.HTMLBody = str_Body
EmailSend.Save
EmailSend.Display
End Sub
Code:
<p>Test body</p><img src="G:\Project Folder\Back Office Information.JPG"><p>End of test body</p>
Does anyone know an easy way to amend the above - either the HTML part or the VBA itself - such that I can send an image which anyone can read.
In case it makes a difference, all recipients will be using Outlook for their email.
Thanks in advance.