#1
|
|||
|
|||
Print document except first page
Hi All,
I have some documents which I want to print in following rules: 1. Print whole document except first page. 2. If there is only a single page in a document then execute another code which I have to use it. Thanks in advance. NG |
#2
|
||||
|
||||
Hi NG,
Try: Code:
Sub PrintPages2Plus() With ActiveDocument If .ComputeStatistics(wdStatisticPages) > 1 Then .PrintOut Background:=True, Range:=wdPrintRangeOfPages, Pages:="2-" & .ComputeStatistics(wdStatisticPages) Else 'your other routine goes here End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hi Macropod,
Thanks for the code. Works fine when there is no page number is given in the document. But when I have execute this on a file which have different page nos. the printer status box shows N/A in "pages" column and doesnt print anything. I forgot in my previous mail that there are different page numbers in each file. Thanks & Regards, NG |
#4
|
||||
|
||||
If you have different page numbering sequences in the document, what is the logic that determines the range to print? For example, do you want to print all except the first page of the entire document, or all except the first page of each numbered range?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hi Macropod,
There is a first blank page in some document and in other docs some text which is not to print (you say it separator page)... So I want only to print whole file except first pages in every file. Once again thank you very much. Warm Regards NG |
#6
|
||||
|
||||
Hi NG,
You still haven't answered my question. Whether your first page is blank makes no difference to the macro - it doesn't care what's on the first page. It simply starts printing at page 2. Here is a different version that you can try. It should work with any document structure: Code:
Sub PrintPages2Plus() With ActiveDocument If .ComputeStatistics(wdStatisticPages) > 1 Then If .Sections(1).Range.ComputeStatistics(wdStatisticPages) > 1 Then .PrintOut Background:=True, Range:=wdPrintFromTo, From:="p2s1", _ To:="p" & .Sections(.Sections.Count).Range.ComputeStatistics(wdStatisticPages) & "s" & .Sections.Count Else .PrintOut Background:=True, Range:=wdPrintFromTo, From:="p1s2", _ To:="p" & .Sections(.Sections.Count).Range.ComputeStatistics(wdStatisticPages) & "s" & .Sections.Count End If Else 'your other routine goes here End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to print on both sides of a page manually | Guy Roth | PowerPoint | 5 | 03-22-2012 06:43 AM |
Background Page color is not covering the entire page when I print the doc | prateekb | Word | 4 | 03-14-2012 01:19 AM |
Dont print header on first page | jezh | Word | 1 | 02-01-2012 09:37 AM |
Not able to print in a page | cookiegal | Outlook | 0 | 06-02-2011 01:02 AM |
Print page one | garon5 | Outlook | 0 | 03-07-2007 02:47 PM |