+ Reply to Thread
Results 1 to 3 of 3

Thread: How can I print specifc pages in Excel 2007?

  1. #1
    Registered User
    Join Date
    11-05-2010
    Location
    California, US
    MS-Off Ver
    Excel 2003
    Posts
    5

    How can I print specifc pages in Excel 2007?

    I'm trying to print 16 pages from one worksheet, double-sided.

    For example I have a 30 page worksheet. I want to print only the odd pages up to pg 15, and then I want to print only the even pages up to page 16. My printer doesn't do two-sided printing, so I need to do it in Excel 2007.

    The most useful thing I found while googling was this macro:
    Sub Odd_Even_Print()
    Dim Totalpages As Long
    Dim StartPage As Long
    Dim Page As Integer
    
    
    StartPage = InputBox("Enter 1 for Odd, 2 for Even")
    
    Totalpages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
    For Page = StartPage To Totalpages Step 2
    ActiveSheet.PrintOut from:=Page, To:=Page, _
    Copies:=1, Collate:=True
    Next
    End Sub
    but it only prints all the even or all the odd pages. I would like to be able to specify a range of odd pages and a range of even pages to print, or even specify exactly what pages I'd like to print like I can in Acrobat Reader or Word 2007.

    I notice that that macro has "from:=Page, To:=Page, _". would I be able to edit this macro to do what I want? If so, would I then need to re-edit the macro for every different sized worksheet?

    Or is there another macro that will put up a dialog box - the same way the above does - that will allow me to specifically print pages 1, 3, 5, 7, etc., or odd pages 1-15?

    Thank you!

    P.S. I did find a workaround whereby I print to PDF first, then print out the pages from there, but it'd be nice to not need to.
    Last edited by Earmite; 01-06-2012 at 05:42 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2009
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    986

    Re: How can I print specifc pages in Excel 2007?

    Try
    Sub PrintPGs()
    
    Dim BegP As Integer, EndP As Integer, Pages As Integer
    BegP = InputBox("Starting", "Print")
    EndP = InputBox("Ending", "Print")
    
        For Pages = BegP To EndP Step 2
            ActiveSheet.PrintOut from:=Pages, To:=Pages, _
            Copies:=1, Collate:=True
        Next Pages
     
    End Sub
    To thank someone who has helped you, click on the star icon below their name.

    I hate reading

    Portfolio

    I need a job.
    I am young and incompetent

  3. #3
    Registered User
    Join Date
    11-05-2010
    Location
    California, US
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: How can I print specifc pages in Excel 2007?

    Thanks JieJenn! That worked perfectly!

    If I understand the macro correctly, I specify the range, and the macro starts at the start page, and just prints every-other page until the specified end page? That's very clever!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0