Sue Mosher re Launch custom form message with default signature example

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

Kristy

Hi Sue

I am using Exchange 2000, Windows XP, and have written a Com add-in
for Outlook 2000/2002(VB6).

I was looking at your sample code to "Launch custom form message with
default signature" and was wondering if you could help me.

I do something similar but the problem is that I have to "display" the
message for it to work, which causes more "activity" on the screen
than I'd like (especially if it doesn't have to be that way). In your
example you don't display objSigMail to get hold of the signature. I
have run your sample (as is) also and had the same results so I am
hoping that it is just my pc and a rebuild or something will fix the
problem... or is the signature only created in the body of the message
when it is displayed (not when it's created), hense I'm stuck with
display or one of the many other options I've tried to get the default
signature into my message?

Example with the additional line of code I need to it to work...

Sub StartNewCustomMsgWithSig(strMessageClass As String)
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colDrafts As Outlook.Items
Dim objMail As Outlook.MailItem
Dim objSigMail As Outlook.MailItem

Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
Set colDrafts = objNS.GetDefaultFolder(olFolderDrafts).Items
Set objMail = colDrafts.Add(strMessageClass)
Set objSigMail = objOL.CreateItem(olMailItem)

'added line required to get the HTML signature
objSigMail.Display

objMail.HTMLBody = objSigMail.HTMLBody
objSigMail.Close olDiscard
objMail.Display

Set objOL = Nothing
Set objNS = Nothing
Set colDrafts = Nothing
Set objMail = Nothing
Set objSigMail = Nothing
End Sub

Thanks also for all of your other samples/tips/tricks/tutorials that
I've made use of so far.
 
I didn't have to display the message for it to work here.

--
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
 
Hi Sue

It was my pc and I now don't have to display the message which is much
better, thanks.

One more question... If you use the below example on a signature that
contains any graphics, it doesn't work as the cid no longer points to
a file location in the new message and the files aren't attached
(using objMail.HTMLBody = objSigMail.HTMLBody).

I have tried numerous different things but can't seem to get anything
to work (although I am still trying to figure out how to use
IHTMLDocument object to see if I can do something with that, I suspect
that I'll still have the same problem with embedded graphics though).

I currently use your EnumAtts sub to see if the mesasge has any
embedded attachments (eg. in the signature). From that you can get the
cid number and the filename of the attachment, could I somehow use
that information to reattach and embed the graphics in the signature
of the new mail?

Can you offer any suggestions on how I might be able to overcome this
issue?

Thanks

Kristy
 
Back
Top