Skip Printing 1st page of the document

N

ng6971

How can I create a marco in ms-word where it will skip the printing of page
no.1 and print only page no. 2 to the end of documnet?
 
D

Doug Robbins - Word MVP

Use:

With ActiveDocument
.PrintOut Range:=wdPrintFromTo, From:="2",
End:=.Range.Information(wdActiveEndPageNumber)
End With


--
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, originally posted via msnews.microsoft.com
 
N

ng6971

Dear Doug Robbins,

I run the code as you have given in the following manner:-

Sub Macro30()
'
' Macro30 Macro
' Macro recorded 22.07.2009 by 123
'
With ActiveDocument
.PrintOut Range:=wdPrintFromTo, From:="2",
End:=.Range.Information(wdActiveEndPageNumber)
End With

End Sub


I have received "Can't execute code in break mode" error message highlighted
this line:
.PrintOut Range:=wdPrintFromTo, From:="2",

Kindly advice. Thanks in advance.
 
D

Doug Robbins - Word MVP

There is a line break that is causing the problem:

Use

Sub Macro30()
'
' Macro30 Macro
' Macro recorded 22.07.2009 by 123
'
With ActiveDocument
.PrintOut Range:=wdPrintFromTo, From:="2", _
End:=.Range.Information(wdActiveEndPageNumber)
End With

End Sub

or put the cursor after the "2", and press the delete key until the
End:=.Range.Information(wdActiveEndPageNumber) is on the same line.


--
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, originally posted via msnews.microsoft.com
 
N

ng6971

Hi Doug,

As suggested I corrected the code and the printer icon appear and disappear
quickly on the status bar but nothing will print. The page numbering of this
file from 101 to 125. Can I run this code on similar documents which is
separate page numbers ?

Sub Macro30()
'
' Macro30 Macro
' Macro recorded 22.07.2009 by 123
'
With ActiveDocument
.PrintOut Range:=wdPrintFromTo, From:="2,
End:=.Range.Information(wdActiveEndPageNumber)"
End With

End Sub
 
D

Doug Robbins - Word MVP

The code should be:

Sub Macro30()
'
' Macro30 Macro
' Macro recorded 22.07.2009 by 123
'
With ActiveDocument
.PrintOut Range:=wdPrintFromTo, From:="2", _
End:=.Range.Information(wdActiveEndPageNumber)
End With

End Sub

How are you getting the first page to be numbered 101?

You might try:

Sub Macro30()
'
' Macro30 Macro
' Macro recorded 22.07.2009 by 123
'
With ActiveDocument
.PrintOut Range:=wdPrintFromTo, From:="101", _
End:=.Range.Information(wdActiveEndAdjustedPageNumber)
End With

End Sub

--
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, originally posted via msnews.microsoft.com
 
N

ng6971

Hi Doug,

Error still continue. This time shows:

Compile error: Named argument not found

As questioned that how the first page to be numbered 101, I clarify this. I
have multiple word files of a book in following manner:
File 1 ..... 10 pages ......... page number starts 1 to 10
File 2 ..... 5 pages .......... page number starts 11 to 15
File 3 ...... 7 pages .......... page number starts 16 to 22
File 4 ...... 3 pages ..... page number starts 23 to 25
File 5 ....... 75 pages ....... page number starts 26 to 100

and so on...

So I just want a code which skips first page of the current active document
and print only balance pages (whatever page number is starting in this
document) of this active document by my default printer.

Thanks in advance.
 
D

Doug Robbins - Word MVP

Use:

With ActiveDocument
.PrintOut Range:=wdPrintFromTo, _
From:=Format(.Sections(1).Headers(1).PageNumbers.StartingNumber + 1), _
To:=Format(.Range.Information(wdActiveEndAdjustedPageNumber))
End With


--
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, originally posted via msnews.microsoft.com
 

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