Solved

# VBA to split PDF File

Posted on 2009-05-12
3,308 Views
Is there a VBA script available which will split a multipage PDF file into individual page PDF Files?
0
Question by:rob546109
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 46

Accepted Solution

ID: 24383634
0

LVL 32

Expert Comment

ID: 24383972
a free method is PDFTK  http://www.pdfhacks.com/pdftk/

it is a command line app that you can call from VBS with the correct parameters.

actually wshexec may be better but i cant find my example.  http://www.microsoft.com/technet/scriptcenter/resources/qanda/may06/hey0519.mspx

Set oSH = CreateObject("WScript.Shell")

sFileInput = "C:\EE\test1.pdf"
sFileOutPrefix = "C:\ee\test1pg_%02d.pdf"
'build the comamnd line'
sPDFTK= "C:\Utils\pdftk.exe  " & sFileInput & " output  " & sFileOutPrefix

'---optionA-----'
oSH.Run sPDFTK, 1, True  'needs TRUE to wait until extern program has finished'
Set oSH = Nothing

'---------------OR---------'
'---option B---'
Set objExec = oSh.Exec(sPDFTK)

Do Until objExec.Status > 0    '0=running,1=finished,2=failed'
Wscript.Sleep 250
Loop

Set objExec = Nothing
set oSH = nothing

0

LVL 44

Expert Comment

ID: 24385470
If you want to use VBA, do you have access to Adobe Acrobat (the full version) on the system? If so, you can use VBA, and I can give you some pointers, but I need to know first if you have Acrobat.
0

LVL 32

Expert Comment

ID: 24391050

the VBS code can be used with Excel VBA with little change.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…