Sar1973
asked on
Embed a .jpg picture in an email with VBA - truble passing from Outlook 2000 to 2003.
Hi I have developed a simple function that work perfectly with Access-Outlook 2000, but not with Access 2000-Outlook 2003.
It does everything but does not embed the image I would insert in preview with the line:
oHTML = "<HTML><Head></Head><Body> <img SRC='" & oLettera & "' width=800 height=1130></Body></HTML> "
I have tried to insert CID parameters and other stuff, but with no result. Can you help, please?
It does everything but does not embed the image I would insert in preview with the line:
oHTML = "<HTML><Head></Head><Body>
I have tried to insert CID parameters and other stuff, but with no result. Can you help, please?
Public Function InviaOutlookMailCampagne(oDestinatario As String, oOggetto As String, oLettera As String, oAllegato As String)
Dim olkApp As Object, olkMsg As Object
Dim oFile As String
Dim oHTML As String
Set olkApp = GetObject(, "Outlook.Application")
'
Set olkMsg = olkApp.CreateItemFromTemplate("L:\9.1.Campagne\Lettere\Modello emailing.oft")
oHTML = "<HTML><Head></Head><Body><img SRC='" & oLettera & "' width=800 height=1130></Body></HTML>"
With olkMsg
.To = oDestinatario
.Subject = oOggetto
.HTMLBody = oHTML
'.body = oMessaggio
'.Attachments.Add oLettera
.Attachments.Add oAllegato
.Save
End With
'
Set olkMsg = Nothing
Set olkApp = Nothing
'
End Function
Of course change the HTLM and add your own image and path.
ASKER
Definitely, the syntax is <img SRC=C:\File.jpg> and not <img SRC='C:\File.jpg'> ...?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this code.
It is straight from the MS website.
It works fine for me.
Please verify that it works "As Is".
Then try to adapt it to work in your Application.
You must set a reference to the Outlook Object Library in your VBA Editor.
JeffCoachman
Open in new window