Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Jules Jules is offline
external usenet poster
 
Posts: 51
Default Print Specific Pages

We have all of our printers set up to print to duplex printing. I am trying
to set up a macro so that when a user wants to print a current page, it will
print the current page and next page if the current page is an odd number or
the previous page and the current page if the current page is an even number.
I have set up the following, but get a "type mismatch" error when it gets to
the actual "printout".

Private Sub OurPrintOut()
Dim IngPN As Long
Dim IngCheck As Long
Dim FollowingPage As Long
Dim PreviousPage As Long
Dim ThisPage As String
Dim TotalPages As Long
ActiveDocument.Bookmarks.Add Range:=Selection.Range, name:="BackHere"
Selection.EndKey unit:=wdStory
TotalPages = Selection.Information(wdActiveEndPageNumber)
ActiveDocument.Bookmarks("BackHere").Select
IngPN = Selection.Information(wdActiveEndPageNumber)
IngCheck = IngPN Mod 2
If IngCheck 0 Then
ThisPage = "odd"
ElseIf IngCheck = 0 Then
ThisPage = "even"
End If
FollowingPage = IngPN + 1
PreviousPage = IngPN €“ 1
ActiveDocument.Bookmarks("BackHere").Select
If TotalPages 1 Then
If ThisPage = "odd" Then
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:=IngPN, To:=FollowingPage
ElseIf ThisPage = "even" Then
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:=PreviousPage, To:=IngPN
End If
ElseIf TotalPages 2 Then
ActiveDocument.PrintOut
End If
End Sub

I have checked that the result of all the definitions is correct, by this I
mean that if I am on page 4 of a 7 page document:
IngPN returns " 4"
FollowingPage returns " 5"
PreviousPage returns " 3"
ThisPage returns "even"
TotalPages returns " 7"
I don't know if the space before each number is significant
Could someone please help me with this
thanks
 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing specific pages of a specific section Rob E Microsoft Word Help 4 October 22nd 09 12:15 PM
printing specific pages Beryl Rippon Microsoft Word Help 7 June 6th 06 07:57 PM
how can i print all the pages of a document that have a specific w tvscrtiptgirl Microsoft Word Help 4 May 10th 06 11:48 PM
How do I print all pages containing a specific word? t.cecil Microsoft Word Help 0 June 15th 05 03:40 PM
How can I print a watermark on specific pages in a big document? jj Microsoft Word Help 1 February 2nd 05 05:52 PM


All times are GMT +1. The time now is 05:21 AM.

Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"