Batch Print PDF Attachments in Outlook

This article was written by Sean Tsai, a data warehousing expert and good friend of the How-To Geek

Have you ever wanted to print every attachment you receive in your Outlook email box? Let’s say you subscribed to a free fax to PDF email service and you want them to be printed out automatically just like an old fashioned fax machine.

Here is a quick way to achieve that if you are comfortable with a little bit of VB (macro) programming.

batch-print-pdf-attachments-in-outlook photo 1

What we showing here is to create a rule in Outlook and move the incoming fax emails into a separate subfolder. Using VB code we create a macro for you to run a print job against every email in that subfolder so you don’t have to open up the email and print the attachments one by one.

Step 1

Create a subfolder named “Batch Prints” under “Mailbox – YourName” in Outlook.

Step 2

Create a rule (from menu Tools/Rules and Alerts) in Outlook that looks like this:

batch-print-pdf-attachments-in-outlook photo 2

Place the email address from your fax vendor in the field “[email protected]”. In the subject line, place the persistent text that is sent from the fax vendor every time (don’t put in the text that will be altered periodically). The 3rd field “Batch Prints” is the subfolder you just created in the first step.

Step 3

Create a VB macro. First bring up the VB editor by going to Tools/Macro/Visual Basic Editor. You should see the VB editor looks like this:

batch-print-pdf-attachments-in-outlook photo 3

Step 4

From the left side Project window, right click on the Project1 item and insert a module named Module1:

batch-print-pdf-attachments-in-outlook photo 4

Step 5

Once the Module1 is created, copy the code below into the window on the right side as shown in the bullet #3.

Public Sub PrintAttachments() Dim Inbox As MAPIFolder Dim Item As MailItem Dim Atmt As Attachment Dim FileName As String Dim i As Integer Set Inbox = GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders.Item("Batch Prints") For Each Item In Inbox.Items For Each Atmt In Item.Attachments ' all attachments are first saved in the temp folder C:\Temp. Be sure to create this folder. FileName = "C:\Temp\" & Atmt.FileName Atmt.SaveAsFile FileName ' please change the program folder accordingly if the Acrobat Reader is not installed on drive C: Shell """C:\Program Files\Adobe\Reader 8.0\Reader\acrord32.exe"" /h /p """ + FileName + """", vbHide Next Item.Delete 'remove this line if you don't want the email to be deleted automatically Next Set Inbox = Nothing End Sub 

Note that you might need to change the line of code that calls Acrobat to match the path on your system.

Step 6

Now the setup is complete. All the emails from your fax vendor will be moved to your “Batch Prints” when they come in. Please note, in the example, we are expecting all attachments are in PDF format so we use Acrobat acrord32.exe to print every attachment.

Using the Macro

Now, when you want to print all attachments, simply go to the macro and run the macro PrintAttachments and all attachments will be printed sequentially. Email will be deleted and moved into trash bin once it has printed.

Note: the prints are routed to your default printer so you have to make sure a valid printer driver is setup and selected.

batch-print-pdf-attachments-in-outlook photo 5

Hope this is useful!

More stories

Quickly Add Appointments to Google Calendar in Firefox

Google Calendar is simply a great calendar application, and for many of us it has become the logical choice. The only problem is that to add a new appointment you have to open the calendar. There should really be a simpler way.

PC Security: Easily Protect Your Home Computer For Free

I get home PC security questions all the time.  So, I figured I would post my opinion on various methods for protecting your PC from viruses, spyware, etc.  First off, I by no means endorse any pay for security suites except for one situation; and that is if you’re grandma is using a PC.  They grew

Fixing Problems with Synergy on Windows Vista

If you use the excellent Synergy application to share your keyboard and mouse between computers, you’ve probably noticed some weird behaviors in Windows Vista… especially when running any application that requires administrator permissions.

Pin Microsoft Outlook to the Desktop Background

Have you ever wanted to just “stick” your Outlook calendar to the desktop? For those of us with multiple monitors it makes even more sense… just having your calendar open on the second monitor at all times would be a great productivity boost.

Quick Tip: Darken the Outlook List Grouping Headers

One of the nicer features of Outlook 2007 is the way it neatly groups your messages by date or other criteria, but it’s not always easy to see at a glance. There’s a little-known option buried in the settings that will shade the group headings to make them more easy to distinguish.

Stupid Geek Tricks: Show Your Name In the System Clock

This tip is absolutely and completely useless, and will even make applications that depend on timestamps have issues. It’s mostly just to be used as a cool trick you can show off to your friends, so we’re going to show you how it works.

Upgrade Ubuntu from Feisty to Gutsy

Ubuntu Gutsy is the latest major release of the most popular Linux distro, released on October 18, 2007. Like all Linux distributions you can upgrade easily even while the release is in beta, but now that it’s been released you should have much better luck with it.

Adobe Shockwave: Crapware With Install

Nothing is worse than spyware, Adware, Malware … etc. However, Crapware comes in extremely close. Crapware is all the extra needless applications say Dell puts on their computers. They sell it as though you’re getting some great deal because your computer is coming pre-installed with say a 90 day

Outlook: Mark Emails as Read

When you have hundreds of e-mails to go through in any given day, it can be difficult to keep track of them all. Going through them in the morning before having your coffee you may miss one or two that you thought were read. Here is a quick tip to show if the message has been read or not from the