How to Insert Image into email with a Macro ??


J

Jonathan E. \(NZ\)

Hi there,
I know very little about macro writing -- which is not very helpful because
I am sitting here wanting to get a macro to do something for me!!
In word I just record them and that works great. But in outlook, as you
know, there is no record option. Ouch...

I think this macro is only a few lines long... so I thought maybe someone
skilled with VBA might be happy to simply tell me what to do or point me to
a website that will show me.

Here is what I want to do..
To set up a macro that will insert an image into an email (one that is being
written) at the point where the cursor is at the time it is activated.
The image source will be hard coded into the macro.
If possible I would like the image alignment to be absmiddle.
I will then duplicate the macro for each image.
I have about 10 images (at a guess) that I want to put into a new drop down
menu... so that when I click on the menu item it will call up the macro and
insert the image into the email.
I know how to set up a macro into new menus etc... just no idea how to write
the macro itself.
Basically I am using this to insert various icons (smilies etc) into a
message without having to go INSERT - PICTURE - Choose the picture - set the
Alignment etc.

Well... if someone you know how to achieve this or can point me to a website
that will teach me how to achieve this I would be very grateful.

With my regards,

Jonathan
New Zealand
 
Ad

Advertisements

S

Sue Mosher [MVP]

This would be possible only if Word is the email editor, since the Outlook
editor provides no information about the insertion point. I just recorded a
macro in Word that showed what method to use:

Selection.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\me.LAN\My Documents\My
Pictures\Dumka2.jpg" _
, LinkToFile:=False, SaveWithDocument:=True

You should be able to do the same thing with Word's macro recorder and take
it from there.
--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Ad

Advertisements

Joined
Mar 25, 2015
Messages
1
Reaction score
0
This is an example, compiled from what I also found on the net. This works fine.
search the net for the example on htmlFile.WriteLine and add the code
http://www.slipstick.com/files/robwhitehouse-script.txt
All credits to Slipstick and Rob Whitehouse. Just added some HTML code to add an image.

htmlFile.WriteLine ("<img src=c:\test.png alt=qr-long.png height=200 width=200>")
to add an image.
 

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

Similar Threads


Top