+ Reply to Thread
Results 1 to 6 of 6

How can I select multiple selections of pages for one print job

  1. #1
    Registered User
    Join Date
    12-09-2012
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    15

    How can I select multiple selections of pages for one print job

    I suspect I'm looking for an impossible solution here, but I want a second and third opinion before I give up.

    I have an excel document that creates a report with multiple sections. Manual page breaks are already in place to divide the sections onto different page breaks when they are printed.
    However, sometimes one section is not applicable. When this is the case, the rows for that section are hidden. This results in blank pages being printed.
    I am not printing the excel document to a printer, but instead printing them to a PDF document with VBA. As the report needs to be one document, I cannot use multiple print-jobs in order to exclude blank pages in the middle of the report.

    Therefore, is there anyway that I can print multiple sections of the report as one print job, without changing the print area? I thought I might be selecting multiple page selections to print, but I haven't worked out a way to do that in one PrintOut statement.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,626

    Re: How can I select multiple selections of pages for one print job

    Try copying only the visible rows to a new tab, say, "printTab" and print this one to the PDF.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    12-09-2012
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: How can I select multiple selections of pages for one print job

    Leah, that means I lose my manual pagebreaks - we still want the report printed in the same shape as previous, just to skip pages were all rows are hidden.
    Do you mean that you know a way to copy pagebreaks as well?

  4. #4
    Registered User
    Join Date
    12-09-2012
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: How can I select multiple selections of pages for one print job

    I'm now using Leah's suggestion, and re-adding my manual pagebreaks to the new tab by searching all pagebreaks in my original tab and checking if EntireRow.Hidden = True for each pagebreak individually. If the row with the pagebreak is not hidden, I search for the same row content in the new tab and add a new manual pagebreak to that row.

    This solution works, but its not ideal as it doesn't let me put pagebreaks on empty rows correctly and its a bit slow (there's 50+ pagebreaks to go through).
    Does anyone have a more efficent/effective solution to this problem?

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,626

    Re: How can I select multiple selections of pages for one print job

    What rule have you made to determine where pagebreaks go? Is it the change in the cells in a particular column? I.e. what do you see that says: "pagebreak here"?

  6. #6
    Registered User
    Join Date
    12-09-2012
    Location
    Australia
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: How can I select multiple selections of pages for one print job

    There is no 'rule' that can be automated like that. Pagebreaks were placed manually in the original document.
    They are put before subject headers, so that a particular subject does not get divided over two pages. While its true there's one particular word that's consistent over all subject headers, we often have 2-3 subjects in one page, completely variant of size - which can differ greatly. There is no way to create a hard rule to specify how often to put a breakpoint on one of these header rows.

    What I have done is use code of the format
    Please Login or Register  to view this content.
    to find each applicable pagebreak in the sheet.
    In the rest of the Do While loop, I read cells in all the columns on the row currentBreakRow and search the entire new document for the content in those cells until I find a match for all of them.

    This works, but its slow, so I'd like to hear if there's a more effective way.

+ 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.6.0 RC 1