Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
Thread | Forum | |||
Printing specific pages of a specific section | Microsoft Word Help | |||
printing specific pages | Microsoft Word Help | |||
how can i print all the pages of a document that have a specific w | Microsoft Word Help | |||
How do I print all pages containing a specific word? | Microsoft Word Help | |||
How can I print a watermark on specific pages in a big document? | Microsoft Word Help |