Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / July 2004

Tip: Looking for answers? Try searching our database.

Sending an HTML message with embedded image from Another VBA app

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Viescas - 23 Jun 2004 15:25 GMT
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,
Signature

John Viescas
(Microsoft Access MVP since 1993)

Sue Mosher [MVP-Outlook] - 23 Jun 2004 15:54 GMT
See http://www.outlookcode.com/d/code/htmlimg.htm

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> 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
[quoted text clipped - 12 lines]
>
> TIA,
John Viescas - 23 Jun 2004 17:30 GMT
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>)

Signature

John Viescas

> See http://www.outlookcode.com/d/code/htmlimg.htm
>
[quoted text clipped - 18 lines]
> >
> > TIA,
Sue Mosher [MVP-Outlook] - 23 Jun 2004 21:45 GMT
Did you look at the 2nd code snippet?

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thanks - but that looks really messy!  So, there's no other way to do it
> other than by using undocumented MAPI properties?  Ouch.
[quoted text clipped - 3 lines]
>
> > See http://www.outlookcode.com/d/code/htmlimg.htm

> > > I recently ran into an interesting question in one of the Access
> e-groups
[quoted text clipped - 20 lines]
> > >
> > > TIA,
John Viescas - 24 Jun 2004 02:23 GMT
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,
Signature

John Viescas

> Did you look at the 2nd code snippet?
>
[quoted text clipped - 34 lines]
> > > >
> > > > TIA,
Sue Mosher [MVP-Outlook] - 24 Jun 2004 02:35 GMT
There are a *huge* number of features that are not exposed in the Outlook object model.
Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx

> Sue-
>
[quoted text clipped - 6 lines]
> Thanks,
> > Did you look at the 2nd code snippet?

> > > Thanks - but that looks really messy!  So, there's no other way to do it
> > > other than by using undocumented MAPI properties?  Ouch.
[quoted text clipped - 36 lines]
> > > > >
> > > > > TIA,
John Viescas - 24 Jun 2004 14:06 GMT
Bummer.  In Access, you can use RunCommand (or DoMenuItem in older versions)
to execute any command available on the menus.

Thanks for the tips.

Signature

John Viescas

> There are a *huge* number of features that are not exposed in the Outlook object model.
>
[quoted text clipped - 7 lines]
> >
> > Thanks,
Andrew Cushen - 24 Jun 2004 16:24 GMT
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
=============================================

>-----Original Message-----
>Bummer.  In Access, you can use RunCommand (or DoMenuItem in older versions)
[quoted text clipped - 19 lines]
>
>.
John Viescas - 26 Jun 2004 18:50 GMT
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!

Signature

John Viescas

> John-
>
[quoted text clipped - 42 lines]
> >
> >.
Sue Mosher [MVP-Outlook] - 30 Jul 2004 23:33 GMT
You can use CommandBars (not a kludge) to execute any toolbar or menu command in Outlook, just as you can in any other Office program. See http://www.outlookcode.com/d/tips/commandbarfun.htm 

The problem with this case and many others is that a lot of functionality is not exposed even in CommandBar commands.
Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook Programming: Jumpstart
     for Administrators, Power Users, and Developers
     http://www.outlookcode.com/jumpstart.aspx

> Bummer.  In Access, you can use RunCommand (or DoMenuItem in older versions)
> to execute any command available on the menus.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.