Article ID: 294748 - Last Review: January 31, 2007 - Revision: 5.2 How to print even and odd pages by using VBA in PublisherThis article was previously published under Q294748 On This PageSUMMARY It is often preferrable to print a publication using both
sides of a single sheet of paper. This is called duplex printing. Some printers
have a setting to turn the paper automatically and print on both sides. On
printers that do not support duplex printing, you can manually perform duplex
printing. Manual duplex printing requires that you print all the odd numbered pages first. When they are finished printing, you have to remove the printed pages from the printer, turn or rotate the pages based on how the printer feeds the paper, and then place the paper back in the printer so that you can print the reverse side. Microsoft Publisher does not have the ability to print only the even or odd numbered pages in a publication. However, starting with Microsoft Publisher 2002, you can use a Microsoft Visual Basic for Applications (VBA) macro to do manual duplex printing. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The following sample macro will work with any document that is using either the Full Page or Custom Publication type layout, as long as you are printing one page per printed page. The PrintOut method does not support the use of optional printing parameters when it is called. PrintOut MethodThe PrintOut method prints all or part of the specified document.Syntax for the PrintOut MethodUse the following syntax for the PrintOut method:
Argument Description
-------------------------------------------------------------------------
From The starting page number. Type: Long.
To The ending page number. Type: Long.
PrintToFile The path and file name of a document to be printed to a
file. Type: String.
Copies The number of copies to be printed. Type: Long.
Collate When printing multiple copies of a document, True to print
all pages of the document before printing the next copy.
Type: Boolean.
Sample MacroThe following sample macro prints the active publication.
| Article Translations
|
Back to the top
