A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Inserting hyperlinked image in message body



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 24th 07, 06:16 AM posted to microsoft.public.outlook.program_vba
Pradeep
external usenet poster
 
Posts: 5
Default Inserting hyperlinked image in message body

Sorry for cross posting, already posted on
microsoft.public.outlook.pragram_addin, but couldn't get any response
from there...

The objective is to insert a hyperlinked image in message being
composed by user. I'm doing this in C++ com addin. Any pointers to
such code?

Here is what I have done till now:


IDispatchPtr pDispWordEditor;
_DocumentPtr pDocumentPtr;
InlineShapePtr pInlineShapePtr;
HyperlinkPtr pHyperLinkPtr;
_bstr_t address("http://www.google.com");


pDispWordEditor = pInspector-GetWordEditor(); //pInspector is
pointer
to inspector
pDispWordEditor-QueryInterface(__uuidof(_Document),
(LPVOID*)&pDocumentPtr);


pInlineShapePtr = pDocumentPtr-Application-Selection-InlineShapes-



AddPicture("C:\\image001.gif");



pHyperLinkPtr = pInlineShapePtr-Hyperlink;
pHyperLinkPtr-Address = address;

everything goes fine but, it crashes at last line where I try to set
pHyperLinkPtr-Address.


I investigated and found that. It might require to add hyperlink to
Hyperlinks collection of document. So i tried :


pInlineShapePtr-Select();
pHyperLinkPtr = pDocumentPtr-Application-ActiveDocument-
Hyperlinks-




Add(pDocumentPtr-Application-Selection-Range);



But it is crashing at this line. Any clues?

This appraoch will serve the purpose in case word is editor (which I
think is always true for Outlook2007). How would this be achieved if
word in not editor in Outlook 2003.

  #2  
Old October 24th 07, 01:23 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Inserting hyperlinked image in message body

In Outlook 2003 with Word not the editor, you'd update the HTMLEditor property with your fully tagged HTML, including a and img elements for the link and image. See http://www.outlookcode.com/d/code/htmlimg.htm for a sample that demonstrates how to add an embedded image.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Pradeep" wrote in message ups.com...
Sorry for cross posting, already posted on
microsoft.public.outlook.pragram_addin, but couldn't get any response
from there...

The objective is to insert a hyperlinked image in message being
composed by user. I'm doing this in C++ com addin. Any pointers to
such code?

Here is what I have done till now:


IDispatchPtr pDispWordEditor;
_DocumentPtr pDocumentPtr;
InlineShapePtr pInlineShapePtr;
HyperlinkPtr pHyperLinkPtr;
_bstr_t address("http://www.google.com");


pDispWordEditor = pInspector-GetWordEditor(); //pInspector is
pointer
to inspector
pDispWordEditor-QueryInterface(__uuidof(_Document),
(LPVOID*)&pDocumentPtr);


pInlineShapePtr = pDocumentPtr-Application-Selection-InlineShapes-



AddPicture("C:\\image001.gif");



pHyperLinkPtr = pInlineShapePtr-Hyperlink;
pHyperLinkPtr-Address = address;

everything goes fine but, it crashes at last line where I try to set
pHyperLinkPtr-Address.


I investigated and found that. It might require to add hyperlink to
Hyperlinks collection of document. So i tried :


pInlineShapePtr-Select();
pHyperLinkPtr = pDocumentPtr-Application-ActiveDocument-
Hyperlinks-




Add(pDocumentPtr-Application-Selection-Range);



But it is crashing at this line. Any clues?

This appraoch will serve the purpose in case word is editor (which I
think is always true for Outlook2007). How would this be achieved if
word in not editor in Outlook 2003.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting a hyperlinked image in messagebody Pradeep Add-ins for Outlook 0 October 23rd 07 12:01 PM
Image in message body instead of attached MSNews Outlook - General Queries 3 April 13th 07 08:46 PM
Inserting hyperlinks/file paths into message body of custom form dch3 Outlook - Using Forms 2 December 7th 06 05:02 PM
Inserting RTF Text in a Message Body Ridge Kennedy Outlook and VBA 4 April 12th 06 03:29 PM
Inserting a picture in the message body of a custom form groom Outlook - General Queries 1 February 8th 06 10:08 PM


All times are GMT +1. The time now is 04:19 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.