Defining and Printing Page ranges in Word

T

TimG

I have a large word file that I want to print selected pages to PDF using
ExportasFixedFormat. I have successfully done the same thing in Excel quite
easily.

But, I am having trouble in Word in defining or selecting the range for this
purpose.
Essentially, I have a 600 page document and different parts of go to 50+
different parties and the page numbers and parties vary each time. I have
already written a macro that goes through the document and identifies the
parties and the page #'s for each and puts that in a table separate document.

So, using this table of page numbers, how do I define/select my range?
 
D

Doug Robbins - Word MVP

There are attributes to the ExportasFixedFormat command that you can use to
control what gets exported. The following is a snippet from the VB help
file for the command.

Range Optional WdExportRange Specifies whether the export range is the
entire document, the current page, a range of text, or the current
selection. the default is to export the entire document.
From Optional Long Specifies the starting page number, if the Range
parameter is set to wdExportFromTo.
To Optional Long Specifies the ending page number, if the Range
parameter is set to wdExportFromTo.


It appears that it may not be quite as flexible as the PrintOut command in
that you may only be able to select a contiguous range of pages, rather than
a page here and a page there.

If you need to export a non-contiguous range of pages, you might be better
off using the PrintOut command with Adobe Acrobat (full version, not just
the reader) or, if you do not have that, one of the free PDF converters
(Primo PDF is one) that you can get from the Web - Google for Free PDF
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

TimG

Thank you. I will try those options of ExportAsFixedFormat. Is there a
better source of all the options and syntax for this command? I find the
help menus to be quite limited.

The benefit of this method over other methods such as PrintOut is that I
have found it easier to pre-define the filenames in a systematic way so that
the files themselves can be easily manipulated.
 
T

TimG

In attempting to use the ExportFromTo, this option does not seem to come up,

Syntax

expression.ExportAsFixedFormat(OutputFileName, ExportFormat,
OpenAfterExport, OptimizeFor, ExportCurrentPage, Item, IncludeDocProps,
KeepIRM, CreateBookmarks, DocStructureTags, BitmapMissingFonts,
UseISO19005_1, FixedFormatExtClassPtr)

expression An expression that returns a Range object.
 
T

TimG

Yeah, I still have syntax issues. It says it wants an array and the
developer notes don't show detailed syntax requirements. Kind of frustrating
as I don't know what format the ExportFromTo data needs to be in and I can't
figure out where to get that information.
 
D

Doug Robbins - Word MVP

The following code creates a .pdf of pages 2, 3 and 4 of the active
document.

ActiveDocument.ExportAsFixedFormat "C:\test.pdf", wdExportFormatPDF, False,
wdExportOptimizeForPrint, _
wdExportFromTo, 2, 4, wdExportDocumentContent, False, False,
wdExportCreateNoBookmarks, False, True, False

It's all there in the VBE Help file. TYpe ExportAsFixedFormat in the VBE
and then press F1

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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