printing

S

Sylvia

I'm not sure if I'm posting this in the right group or not. If I'm not in
the right place could someone please suggest the appropriate list? Thanks.

Here's what I need to do.

I have a Word document that is 11,000 pages. I need to print it, based on
page numbers to separate PDF files(I have Acrobat Pro 8).

For instance, I need pages 1-13 to be printed to a (new) file named
PDFA.PDF; pages 14-20 to be printed to PDFB.PDF, etc.

I have to go through the document to determine which page numbers go to
which PDF file (the pages will always be sequential).

Any ideas on how to do this?

Thanks!
 
G

Graham Mayor

If the macro cannot automatically work out which pages go in which file (and
from the information you have provided, there is no way to do that) then
there is no way to do this but manually. A start would be to explain which
groups of pages go in which PDF?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Sylvia

I know which pages go in which file. Is there a way to tell the macro that:

Pages 1-9 print to PDFA.PDF
Pages 10-14 print to PDFB.PDF
etc.

I'm thinking that this is probably more of a script thing than a macro.
 
G

Graham Mayor

Yes you can tell the macro to print those blocks, but if you expect the
macro to work it out for the remaining 10,000+ pages, you need to be able to
tell the macro how to do that. If you can tell us by what criteria you use
to determine which groups of pages go together eg you have 9 pages in the
first group (you said 1-13 last time) and 5 in the second group, with no
apparent correlation between the two? What about the other rest?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Sylvia

I will be going through the entire document to determine which pages go to
which file. I'd like to write the macro based on that.
 
J

Jonathan West

Sylvia said:
I will be going through the entire document to determine which pages go to
which file. I'd like to write the macro based on that.

Then you need to make a list of the page ranges, and put it into an array,
so that the first item contains 1-9, the next 10-13, and so on. It might be
quicker to print the page ranges manually.

What Graham is wanting to know is whether there is some description you can
give by which specifies how you decide that the first file will contain 9
pages, and the next one will contain 4. For instance, do you want to start a
new file at each occurrance of a Heading 1 paragraph? If there is an
unambiguous description of how you will make the decision about where the
breaks come, then it may be possible to implement that description into a
VBA macro, without you having to build the list by hand.
 
S

Sylvia

What I could do is go through the document and put section breaks in as
separators. Would that help?
 
J

Jonathan West

Sylvia said:
What I could do is go through the document and put section breaks in as
separators. Would that help?

That would do. Then the code can print each section in turn. How many
sections will there be? If more than 26, what name do you want to give to
the next file after PDFZ.PDF?
 
S

Sylvia

I guess it would make more sense to go with numbers rather than letters, and
to use the format PDF000.pdf since there will be over 100.

Thanks!
 
G

Graham Mayor

Provided each new section starts on a new page (as the following will print
any part of the following section(s) on the final page of the section being
processed) the macro below will create a PDF for each section named
PDFnnn.pdf in the folder configured in Acrobat's PDF Printer driver
properties.

To get around the naming issue without addressing the Acrobat driver
directly (about which I have no experience), the macro renames the document
as each section is processed, before finally saving the document with its
original name. This will give you as many copies of the document as you have
sections, in the folder indicated in the macro i.e. "D:\My
Documents\Test\Merge\". You can delete those at the end.

Sub PDFs()
Dim i As Long
Dim sPrinter As String
Dim sFilename As String
Dim aDoc As String
aDoc = ActiveDocument.FullName
sPrinter = ActivePrinter
ActivePrinter = "Adobe PDF"
With ActiveDocument
For i = 1 To .Sections.Count
sFilename = "PDF" & Format(i, "000") & ".doc"
.SaveAs "D:\My Documents\Test\Merge\" & sFilename
.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
Next i
.SaveAs aDoc
End With
ActivePrinter = sPrinter
End Sub

May I suggest that you start with a copy of your document?
The above was tested with Word 2003 and Acrobat 8.1
For Word 2007 change the line
sFilename = "PDF" & Format(i, "000") & ".doc"
to
sFilename = "PDF" & Format(i, "000") & ".docx"
http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Sylvia

I have a word document that has several section. I'd like to save each
section as its own file. Could someone point me to a macro to help do that?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top