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",
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
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
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
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.
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