Images into Outlook 2007

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 
R

roccogrand

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
 
K

Ken Slovak - [MVP - Outlook]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top