Consulting

Results 1 to 2 of 2

Thread: Duplex Printing For 3 Hole Punched Paper

  1. #1
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location

    Duplex Printing For 3 Hole Punched Paper

    Good afternoon all, I am looking to print a worksheet onto the front & back of 3 hole punched paper. When I print, in this case 5 pages, the back pages (2 & 4) are in the area of the hole punch. I found a sub on the internet that I thought would adjust the page setup for each page but it doesn't work. Does anyone know of a way to do this? Can it be done or am I out of luck?

    Here is what i'm working with:

    Sub PrintOddEven()
        Dim hBreak As HPageBreak
        Dim lNum As Long, lTotal As Long
        Dim rLast As Range
         
        With ActiveSheet
            Set rLast = .Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious)
                                    .PageSetup.PrintArea = .Range("A1", rLast).Address
            ActiveWindow.View = xlPageBreakPreview
            lTotal = .HPageBreaks.Count + 1
             
            For Each hBreak In .HPageBreaks
                lNum = lNum + 1
                 
                If lNum Mod 2 <> 0 Then
                    With .PageSetup
                        .RightMargin = 0
                        .LeftMargin = 30
                        .TopMargin = 30
                        .BottomMargin = 30
                    End With
                    '.PrintOut lNum, 1
                 Else
                    With .PageSetup
                        .RightMargin = 30
                        .LeftMargin = 0
                        .TopMargin = 30
                        .BottomMargin = 30
                    End With
                    '.PrintOut lNum, 1
                End If
            Next hBreak
        End With
        ActiveSheet.PrintPreview
        ActiveWindow.View = xlNormalView
    End Sub
    Thanks
    Gary

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Just wondering the line " If Lnum Mod 2 <> 0" is defining the test incorrectly. Surely we should be testing if the page number is odd or even and then applying the page settings for each result.

    Maybe something along the lines;

    If ISEVEN(Lnum) then
    page settings 2
    else
    page settings 1
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •