Inserting hyperlinked image in message body

  • Thread starter Thread starter Pradeep
  • Start date Start date
P

Pradeep

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.
 
Back
Top