How to Quickly Print All Image Attachments of an Outlook Email on One Page Only

In order to save printer ink and paper, some users wish to print all images attached in an email on one page only, instead of one image per page. Now, this article will share a means to realize it.

As we all know, printing images is quite wasting printer ink. Thus, so as to save printer ink and paper, maybe you prefer printing many image attachments on the same page instead of printing images on separate pages. Though Outlook doesn’t offer such a feature, you still can achieve it by the following means.

Quickly Print All Image Attachments of an Outlook Email on One Page Only

Print All Image Attachments of an Outlook Email on One Page Only

  1. To start with, launch your Outlook application.
  2. Then, in the Outlook window, tap on the “Alt + F11” key buttons.
  3. Next, you’ll get into the “Microsoft Visual Basic for Applications” window, in which you have to firstly enable “Microsoft Word Object Library”.
  4. After that, you need to open a module that is not being used.
  5. Subsequently, copy and paste the following VBA code into this module.
Sub PrintAllImageAttachmentsOnOnePage()
    Dim objSourceMail As Outlook.MailItem
    Dim objAttachment As Outlook.Attachment
    Dim objTempMail As Outlook.MailItem
    Dim objTempDocument As Word.Document
    Dim objWordApp As Word.Application
    Dim strImage As String
    Dim objImage As Word.InlineShape
 
    Select Case Outlook.Application.ActiveWindow.Class
           Case olInspector
                Set objSourceMail = ActiveInspector.currentItem
           Case olExplorer
                Set objSourceMail = ActiveExplorer.Selection.Item(1)
    End Select
 
    If Not (objSourceMail Is Nothing) Then
       'Create a temp mail
       Set objTempMail = Outlook.Application.CreateItem(olMailItem)
       objTempMail.Display
       Set objTempDocument = objTempMail.GetInspector.WordEditor
       Set objWordApp = objTempDocument.Application
 
       Set objFileSystem = CreateObject("Scripting.FileSystemObject")
 
       For Each objAttachment In objSourceMail.attachments
           'Get the Image attachments, instead of inserted Images
           If IsEmbedded(objAttachment) = False Then
              Select Case LCase(objFileSystem.GetExtensionName(objAttachment.filename))
                     Case "jpg", "jpeg", "png", "bmp", "gif"
                          strImage = "E:\" & objAttachment.filename
                          objAttachment.SaveAsFile strImage
 
                          'Insert the images into the temp mail
                          Set objImage = objWordApp.Selection.InlineShapes.AddPicture(filename:=strImage, LinkToFile:=False, SaveWithDocument:=True)
                          objWordApp.Selection.TypeText Text:=" "
 
                          'shrink the images to insure that they are on one page
                          objImage.ScaleHeight = 20
                          objImage.ScaleWidth = 20
 
                          Kill strImage
             End Select
           End If
       Next
 
       objTempMail.PrintOut
       objTempMail.Close olDiscard
    End If
End Sub

Function IsEmbedded(objCurAttachment As Outlook.Attachment) As Boolean
    Dim objPropertyAccessor As Outlook.propertyAccessor
    Dim strProperty As String
 
    Set objPropertyAccessor = objCurAttachment.propertyAccessor
    strProperty = objPropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")
 
    If InStr(1, strProperty, "@") > 0 Then
       IsEmbedded = True
    Else
       IsEmbedded = False
    End If
End Function

VBA Code - Print All Image Attachments of an Outlook Email on One Page Only

  1. Later, you can back to the email list. Choose or open an email whose picture attachments you want to print out.
  2. Then, trigger this macro. In the current macro window, just press “F5” key or click the “Run” icon in the toolbar.
  3. Finally, when the macro finishes running, all image attachments of the source email will be printed out on one page, like the following screenshot:Images on One Page Only

Deal with Corrupted Outlook Files

With more and more data stored in your Outlook, your Outlook file be increasing vulnerable. It can get compromised due to various internal and external factors. Also, it is difficult to predict Outlook corruption. So, what you can do is to insure immediate and effective rescue when meeting Outlook corruptions. For instance, you have to keep a specialized PST repair tool, like DataNumen Outlook Repair in vicinity. It will scan and restore damaged files like a breeze.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover Sql Server and outlook repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *