Embedded Graphics AND Signatures Please...

  • Thread starter Thread starter Kristy
  • Start date Start date
K

Kristy

Hello

I posted this to microsoft.public.outlook but it was suggested that I
might have more luck posting it directly here, I apologise if you have
already seen this.

I have written a vb6 com add-in for Outlook XP using the guidelines
set by Microeye. The main part of the program embeds a graphic
(thanks Neo!) into a new mail message. I then wrote another small
procedure that uses the commandbar object to insert the default
signature into the email. I assigned both of these to
commandbarbuttons on my custom toolbar. Individually (ie, click on
icon on the explorer toolbar to create a new mail message and embed
the graphics and once displayed click on icon on inspector toolbar to
insert signature) they both work every time, the trouble started when
I decided it would be better to make the two steps into one!

I tried calling the InsertSignature sub routine directly from the
EmbedGraphic routine after the message was displayed but before
releasing the objects as this seemed to be the best place to put it.
Stepping through it the code appears to work as expected and there are
no errors generated, however there is also no signature inserted on
the email!

After I couldn't get that to work I stooped so far as to call the
click event of the Insert Signature routine as the very last thing
before End Sub when everything else was completed as I thought this
would produce the same effect as doing it manually, but still no
signature. I am not getting any errors of any kind to go by and like I
said previously if I run the InsertSignature routine manually after
the other is completely finished there is no problem. Does anyone know
if there is another way I can try calling it? Is it somehow staying
in memory? I've checked that I have cleaned up all of my objects
properly.

I then tried a different approach, I displayed the new email before
attaching & embedding the graphics so that I could grab the default
signature from the HTMLBody property and then use it later on to
rebuild the email - see below:

Set golApp = CreateObject("Outlook.Application")
Set oNameSpace = golApp.GetNamespace("MAPI")

Set MyMsg = golApp.CreateItem(olMailItem)

'additional line of code to get HTMLBody with default signature in
memory
MyMsg.Display

Set colAttach = MyMsg.Attachments
Set Attach1 = colAttach.Add(File1.jpg)
Set Attach2 = colAttach.Add(File2.jpg)

MyMsg.Close olSave
strEntryID = My.EntryID

Set MyMsg = Nothing
Set colAttach = Nothing
Set Attach1 = Nothing
Set Attach2 = Nothing

Then Later...

MyMsg.HTMLBody = "<IMG align=right border=0 hspace=0
src=cid:Graphic1>" & "<br>" _' & "<HTML><HEAD><TITLE>Test </TITLE>" &
"</HEAD><BODY></B>" & MyMsg.HTMLBody & "</BODY></HTML>" _'& "<IMG
align=left border=0 hspace=0 src=cid:Graphic2>"

..... this succeeded in getting the signature in the email but the
graphics ended up as square boxes with red crosses? For some reason
displaying the email changed something about it and then I couldn't
embed the graphics properly? Any ideas how to get it back to the
state it was in before it was displayed, or even better how to write
the signature into the Body without having to display it first?

Can anyone help, I know that programmatically embedding graphics is
unsupported but I would really appreciate any suggestions that you may
have.
 
Whatever graphics you're using in the signature would also need to be embedded in the message with proper cid values assigned.
--
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
 
Back
Top