Sending an HTML message with embedded image from Another VBA app

  • Thread starter Thread starter John Viescas
  • Start date Start date
J

John Viescas

I recently ran into an interesting question in one of the Access e-groups I
visit. I know how to set up and send an HTML message from VBA using the
HTMLBody property. But how does one embed an image? I suppose the simplest
way is to make the image available on a public website and the set SRC= to
point to that file. But I know that I can also imbed the image directly
from the UI -- outlook sends the image as an encoded MIME part of the
message and references it with a CID:. Interestingly, if you try to Save As
HTML a message that you've received this way, Outlook doesn't save the
<nextpart> encoded image. It would be cool if Outlook had a macro recorder
like Word and Excel so that I could go through the steps in the UI and see
what Outlook actually does.

So, the question is: How do you embed an image in an HTML message using
automation form VBA?

TIA,
 
Thanks - but that looks really messy! So, there's no other way to do it
other than by using undocumented MAPI properties? Ouch.

Looks like I'll have to order your book... <s> (Or, I can offer a signed
copy of Microsoft Office Access 2003 Inside Out in trade. <g>)
 
Did you look at the 2nd code snippet?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sue-

Yes, I did. And I even tested it. And as advertised, the picture doesn't
display properly in the message and also appears as a regular attachment.
But the objective is to create the same effect you get from the UI when you
create a new HTML message and then choose Picture from the Insert menu.
Surely Outlook isn't using MAPI for that -- or is it?

Thanks,
 
There are a *huge* number of features that are not exposed in the Outlook object model.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
 
Bummer. In Access, you can use RunCommand (or DoMenuItem in older versions)
to execute any command available on the menus.

Thanks for the tips.
 
John-

If you don't mind kluges, you can always use SendKeys to
click on menus. See this link:
http://www.dimastr.com/outspy/howto.htm#oom2
on the OutlookSpy website (an indispensable tool for heavy
Outlook lifting) re: how to identify toolbar buttons o you
can click them programmatically.

That's about the only way I can think of do do what you
want.

-Andrew
=============================================
 
Ugly, ugly. Because what I want to do is insert a picture inline, I'd have
to make the new message window visible, make sure I'm positioned within the
message correctly, do a SendKeys of the file name and Enter, then do
Btn.Execute.

I think I'll stick with Access programming... <s>

Thanks for the link!
 
Back
Top