PDA

View Full Version : Dont Print Last Page



twitch73
03-18-2013, 12:11 AM
Hi All,

Rather frustrated for something I know will be so very simple.
I have the following code to print a document



Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="1-7", PageType:= _ wdPrintAllPages, ManualDuplexPrint:=False, Collate:=True, Background:= _ True, PrintToFile:=False, PrintZoomColumn:=0, PrintZoomRow:=0, _ PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

This prints the entire 7 pages.

What I want to print is the document EXCEPT the last page. I can't set it to 1-6 and the number of pages always varies.

Can onyone help with the simple code to print all pages, except the last?

Thanks in advance

Doug Robbins
03-18-2013, 12:42 AM
Use:

Dim i As Long
With ActiveDocument
i = .BuiltInDocumentProperties(wdPropertyPages)
.PrintOut Range:=wdPrintFromTo, From:="1", To:=i - 1
End With