Images into Outlook 2007

  • Thread starter Thread starter roccogrand
  • Start date Start date
R

roccogrand

I would like to create a macro that inserts images into Outlook messages.
The following statement works in Word 2007 but not in Outlook 2007.

Selection.InlineShapes.AddPicture FileName:= _
"C:\Users\ac360.jpg", LinkToFile:=False, _
SaveWithDocument:=True

Would someone please provide me with the statement to insert jpg and gif
images stored on my hard drive. The statement will be associated with a
custom button on Outlook.

Thanks.

David
 
Dim oMail As Outlook.MailItem

' only works if the button is on the open item
Set oMail = Application.ActiveInspector.CurrentItem
oMail.Attachments.Add "filePathToAttachment"
oMail.Save

Of course you will need to hard code the attachment file name/path or pass
that to your macro.
 
Thanks Ken for the code snippet but it attaches the file to the email. I
want to insert the images directly into the message at the insertion point
like I can do manually.

Is that possible through code? I can do this in Word 2007 (my original
macro), which as I understand it is the wordprocessor behind Outlook 2007.

David
 
In that case get the Inspector.WordEditor object, which is a Word document
object and try your existing code on that document object. ActiveInspector
would be the Inspector to use.

I'm not sure that will work correctly, there are some limits on what you can
do with the Word object model when using the new WordMail editor.
 
Back
Top