Domenic
This is code from 2004 but it works for me with Outlook 2010 sending the message.
However when I receive the message in Outlook the image is on a different 'page', but when I receive it at my Google Mail account it's fine.
That could be down to some setting I've got in Outlook, or just a problem I'm having - it wouldn't be the first trouble I've had with images in email.
Actually just read something that says the problem is Outlook 2010, something to do with inline CSS not being supported any more.
I knew about that but not that it would cause this sort of problem.
Anyway, enough wittering here's the code:
Rich (BB code):
Option Explicit
'Add reference to MS Outlook x.x Object Library
'Picture to be added as an attachment and modified src location for each embedded picture.
Private Sub Command1_Click()
Dim oApp As Outlook.Application
Dim oEmail As MailItem
Dim colAttach As Outlook.Attachments
Dim oAttach As Outlook.Attachment
'create new Outlook MailItem
Set oApp = CreateObject("Outlook.Application")
Set oEmail = oApp.CreateItem(olMailItem)
'add graphic as attachment to Outlook message
'change path to graphic as needed
Set colAttach = oEmail.Attachments
Set oAttach = colAttach.Add("C:\Users\Norie\Pictures\FlyingPuffin.jpg")
oEmail.Close olSave
'change the src property to 'cid:your picture filename'
'it will be changed to the correct cid when its sent.
oEmail.HTMLBody = "" & _
"
"
oEmail.Save
oEmail.Display 'fill in the To, Subject, and Send. Or program it in.
Set oEmail = Nothing
Set colAttach = Nothing
Set oAttach = Nothing
Set oApp = Nothing
End Sub