Mass print PDF files based on file path and quantity in excel document.

sam55

New Member
Joined
Dec 3, 2019
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I have a excel list with 2 columns. One for the local path to the PDF file and the other the print quantity. (see example below) I’m looking for a way to mass print the first pages of each PDF for the number of pages listed on the excel sheet.

PathPrint quantity
C://Test1.pdf10
C://Test2.pdf50
C://Test3.pdf5
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Check if the following works for you.
Check on your computer which version of Acrobat (AcroRd32.exe) you have to print PDF and the path where the program is located ("C:\Program Files\Adobe\Reader 11.0\Reader\").

VBA Code:
Sub PrintPdfs()
  Dim i As Long, j As Long, wFile As String, wPath As String, wnum As Variant
 
  wPath = "C:\Program Files\Adobe\Reader 11.0\Reader\"
 
  For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
    wFile = Range("A" & i).Value
    wnum = Range("B" & i).Value
    If wFile <> "" Then
      If Dir(wFile) <> "" Then
        If wnum > 0 And IsNumeric(wnum) Then
          For j = 1 To wnum
            Shell wPath & "AcroRd32.exe /n /t " & wFile
            DoEvents
            Application.Wait Now + TimeValue("00:00:01")
          Next
        End If
      End If
    End If
  Next
End Sub
 
Upvote 0
The hardest part is getting it to only print the first page. I don't think you can select pages to print using shell, but if you have Adobe Acrobat (not reader actual acrobat) installed you could use that reference and set it to print specific pages.
 
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top