Autoprint email (plain text, html, attachments) (with message rule and VBA)

From: Tom Van Overschelde (
Date: 09/13/04

Date: Mon, 13 Sep 2004 14:08:54 +0200


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)


    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.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!!


* 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)

Relevant Pages

  • Re: OE6 - cant send emails with attachments
    ... Tried increasing the timeout slider under Tools/Accounts, ... > attachments, and emails without attachments fine - ... Trying to send via a different email account from ...
  • OE6 - cant send emails with attachments
    ... I have a client with the exact same issue. ... attachments, and emails without attachments fine - ... >integrated into DSL router and with Norton Anti-Virus ...
  • Re: Send Receive
    ... After running 'regsvr32 inetcomm', does the attachments dialog return? ... Help with Hijackware ... > emails with attachments In the options security dialog box ...
  • Re: Outlook 2003 send failure
    ... email with large attachments with OE. ... >> I keep experiencing a problem sending emails in Outlook ... >> My ISP doesn't support Outlook, ...
  • Re: OE6 - cant send emails with attachments
    ... Niall Keppie wrote: ... > Would really appreciate your help, as I currently can't send emails ... However when attempting to send an email with attachments the ... Scanning of incoming email is the biggest waste of CPU cycles ever ...