Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 3912

# VBA to split PDF File

Is there a VBA script available which will split a multipage PDF file into individual page PDF Files?
0
rob546109
• 2
1 Solution

Commented:
0

Commented:
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

Commented:
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

Commented: