?
Solved

VBA to split PDF File

Posted on 2009-05-12
6
Medium Priority
?
3,560 Views
Last Modified: 2012-05-06
Is there a VBA script available which will split a multipage PDF file into individual page PDF Files?
0
Comment
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
  • Learn & ask questions
  • 2
6 Comments
 
LVL 46

Accepted Solution

by:
tbsgadi earned 1500 total points
ID: 24383634
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
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 
 
Wscript.Echo objExec.StdOut.ReadAll()   'just for testing'
Set objExec = Nothing
set oSH = nothing

Open in new window

0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
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

by:Robberbaron (robr)
ID: 24391050
apologies. hadnt read the op fully.

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

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question