T
Tom Van Overschelde
Hello,
I have to print all incoming emails including attachments.
The idea was to create an inbox rule. There is a standard rule which allows
me to print an email. However the problem with this, is that no inline
attachments are printed (our client uses an html signature with an embedded
gif image). The message itself is printed, but the attachment is printed as
a box with an X.
The strange thing is, when I open myself the message and choose to print,
everything looks good on the paper. So I thought, if I can this do by hand,
with a VBA macro, this must also work. I experimented with some code,
changed things, security settings, tried almost everything, but I still get
no inline gifs on the paper:
Sub AutoPrint(Item As Outlook.MailItem)
Item.Display
Dim objInsp
Dim colCB
Dim objCBB
'On Error Resume Next
Set objInsp = Item.GetInspector
Set colCB = objInsp.CommandBars
' Print toolbar button
Set objCBB = colCB.FindControl(, 2521)
If Not objCBB Is Nothing Then
Wait 2 'waits 2 seconds
objCBB.Execute
'objCBB.Enabled = False
End If
Set objCBB = Nothing
Set colCB = Nothing
Set objInsp = Nothing
Item.Close olDiscard
End Sub
A previous variant with item.printout didn't work. The message was printed,
but I've got the same result as with the code here above, so no inline
images are printed. I think this comes because the messages are html
formatted, and outlook passes the message to Internet Explorer to print out.
But Internet Explorer doesn't find the embedded GIF image (Outlook gives me
also the message to open first the email when I choose 'print' from the
inbox). So that's the reason that I used 'item.display' in my code to open
first the message en then print. When I do it by hand, it works perfectly.
But with an inbox rule and the code above, no inline images. How can I
arrange this? In a later stage, I want to print also some attachment types,
but this is not the priority for the moment.
Suggestions? Ideas??
Many thanks in advance!!
Tom
Remarks:
* I tested this on 2 different computers
* the emails are stored on an IMAP mailserver, and access with the IMAP
protocol on Outlook 2003 (updated to SP1)
I have to print all incoming emails including attachments.
The idea was to create an inbox rule. There is a standard rule which allows
me to print an email. However the problem with this, is that no inline
attachments are printed (our client uses an html signature with an embedded
gif image). The message itself is printed, but the attachment is printed as
a box with an X.
The strange thing is, when I open myself the message and choose to print,
everything looks good on the paper. So I thought, if I can this do by hand,
with a VBA macro, this must also work. I experimented with some code,
changed things, security settings, tried almost everything, but I still get
no inline gifs on the paper:
Sub AutoPrint(Item As Outlook.MailItem)
Item.Display
Dim objInsp
Dim colCB
Dim objCBB
'On Error Resume Next
Set objInsp = Item.GetInspector
Set colCB = objInsp.CommandBars
' Print toolbar button
Set objCBB = colCB.FindControl(, 2521)
If Not objCBB Is Nothing Then
Wait 2 'waits 2 seconds
objCBB.Execute
'objCBB.Enabled = False
End If
Set objCBB = Nothing
Set colCB = Nothing
Set objInsp = Nothing
Item.Close olDiscard
End Sub
A previous variant with item.printout didn't work. The message was printed,
but I've got the same result as with the code here above, so no inline
images are printed. I think this comes because the messages are html
formatted, and outlook passes the message to Internet Explorer to print out.
But Internet Explorer doesn't find the embedded GIF image (Outlook gives me
also the message to open first the email when I choose 'print' from the
inbox). So that's the reason that I used 'item.display' in my code to open
first the message en then print. When I do it by hand, it works perfectly.
But with an inbox rule and the code above, no inline images. How can I
arrange this? In a later stage, I want to print also some attachment types,
but this is not the priority for the moment.
Suggestions? Ideas??
Many thanks in advance!!
Tom
Remarks:
* I tested this on 2 different computers
* the emails are stored on an IMAP mailserver, and access with the IMAP
protocol on Outlook 2003 (updated to SP1)