+ Reply to Thread
Results 1 to 17 of 17

Unique Print to PDF Challenge

  1. #1
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Unique Print to PDF Challenge

    Good day all,

    I have an Excel workbook with various sheets inside, each of these sheets must be converted to a PDF in sequential order. i.e. Lab 1, Lab 2, Lab 3, Lab 4, etc.
    The issue I run into sees my macro run, however it only creates one PDF file and it doesn't number the report (Lab 1, Lab 2, etc.) as I had hoped. I'm hoping someone here can show me the error I'm missing. The code is below, however I've changed some of the file destination information to make it generic looking. Please forgive my ignorance, I'm still relatively new to this whole VBA thing.
    (Also, please forgive me for not uploading the workbook, it's on a government server and they're not too happy to see proprietary information uploaded to the web.) Thank you in advance!

    Please Login or Register  to view this content.
    Last edited by shawnpatrick; 10-04-2019 at 03:51 PM.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    What needs to be changed/added to this?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    That's very close, thank you. However, I only need the following sheets: "indv rep", "chart1", "chart2"

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    Thank you again. It's close, but it's still not the solution I was hoping for. Rather than combining the three worksheets into one and numbering each combination of the three, this code pulls each worksheet individually and numbers them individually. For example "indv rep" is "lab 1", "chart2" is "lab 2", and "chart3" is "lab 3". What I'd like to accomplish is "indv rep", "chart1", and "chart2" would all create "Lab 1", then move to the next one until the VBA runs through all 130 labs. It's numbering them sequentially (and beautifully, thank you!), but unfortunately it's numbering each one independent of the others.

    I know it's a bit of a pain, but I thank you so much for your help, it's appreciated more than I can express!

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    Please Login or Register  to view this content.
    If this is not it, maybe explain in detail what is needed.
    "then move to the next one" means something to you because you know your workbook but we don't so it does not mean anything to me.

    Or do you want "indv rep" + Chart1 + Chart2 as Lab 1, indv rep + Chart3 + Chart4 As Lab 2, indv rep + Chart5 + Chart6 As Lab 3, indv rep + Chart7 + Chart8 as Lab4 etc etc?
    Last edited by jolivanes; 10-07-2019 at 03:14 PM. Reason: Changed the PDF line

  7. #7
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    Quote Originally Posted by jolivanes View Post

    Or do you want "indv rep" + Chart1 + Chart2 as Lab 1, indv rep + Chart3 + Chart4 As Lab 2, indv rep + Chart5 + Chart6 As Lab 3, indv rep + Chart7 + Chart8 as Lab4 etc etc?
    Thank you again. Yes, sort of. In my workbook I have multiple worksheets, and on 3 of those worksheets I have the sum of all data from the rest of the worksheets. I am attempting to compile the "indv rep" + "chart1" + "chart2" into one PDF. Those 3 sheets are the results pages for the rest of the workbook.
    The indv rep details the individual lab's results, while chart1 and chart2 detail their results on a scatter graph I have created. Together, these three worksheets make up one PDF known as Lab 1. After Lab 1, the same process is run (looped) to create the unique results for Lab 2, and so on until I have compiled PDF files for each of my 130 laboratories. The following pictures are just a portion of what is generated when I print to PDF.
    Indvidual Report Attachment 644404
    Chart1Attachment 644405
    Chart2 Attachment 644406
    Thanks again.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    So 'indv rep" sheet + "chart1" sheet + "chart2" sheet will be saved as a PDF file named "Lab 1". No problem here.
    What are the names of the sheets that will be saved as "Lab 2"? And the names of the sheets for "Lab 3"? etc etc

    To add an attachment, go as follows:
    At the bottom RH side, click on "Go Advanced"
    Click on "Manage Attachments"
    Click on "Choose File".
    Select the file you want to attach.
    Click on "Upload"
    Once when uploaded, click on "Close this Window".

    Don't really need attachments though. Just the names of the sheets for each batch of 3.
    Last edited by jolivanes; 10-08-2019 at 10:38 AM. Reason: Added info

  9. #9
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    Man, I wish I could upload the workbook for you, but it's government property.
    Anyhow, Lab 1, Lab 2, Lab 3, etc. are all built from the same workbook, it's just that each lab is called up independently in the code I have (and each lab pdf still references indv rep, chart1 and chart2).
    Let me see if I can pare down the information and create a mock workbook to upload. I know that flying into this one is like walking in the dark and stubbing your toe. Thanks for the help so far, if I could add more + rep, I would!

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    Is it maybe that you run a macro that populates the "indv rep" sheet which changes the charts in "Chart1" and "Chart2"?
    You now want to save these three sheets to a single PDF file as "Lab 1".
    Run the macro again to populate the "indv rep" sheet with new data and now save the three sheets as a single PDF file again but with the new data as "Lab 2"
    Keep this going till all your customers(?), with their relevant data, have been saved to PDF files?

    Is the above thinking anywhere near what you have in mind?

    In the code you have in the first post you save the file with the value of cell A2 of the "Indv Rep" sheet and combine "Lab " with that value.
    Does that value need to be increased by every time or discard that part and just add an increasing value for every PDF save?
    Note: In the code you use capital letters while in some post you do not. You might have to be consistent with naming otherwise you end up with errors.

    Please Login or Register  to view this content.
    Last edited by jolivanes; 10-08-2019 at 04:45 PM. Reason: more info

  11. #11
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    Quote Originally Posted by jolivanes View Post
    Is it maybe that you run a macro that populates the "indv rep" sheet which changes the charts in "Chart1" and "Chart2"?
    You now want to save these three sheets to a single PDF file as "Lab 1".
    Run the macro again to populate the "indv rep" sheet with new data and now save the three sheets as a single PDF file again but with the new data as "Lab 2"
    Keep this going till all your customers(?), with their relevant data, have been saved to PDF files?

    Is the above thinking anywhere near what you have in mind?
    Yes, exactly! ^_^

    Quote Originally Posted by jolivanes View Post
    In the code you have in the first post you save the file with the value of cell A2 of the "Indv Rep" sheet and combine "Lab " with that value.
    Does that value need to be increased by every time or discard that part and just add an increasing value for every PDF save?
    Note: In the code you use capital letters while in some post you do not. You might have to be consistent with naming otherwise you end up with errors.
    Discard that and then increase the "Lab" value each time.
    Yeah, sometimes my attempts at coding is a hot mess.

  12. #12
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    OK, so you change the data in "indv rep" but where do you get this data from?
    Do you have a bunch of sheets named "Lab 1", "Lab 2", "Lab 3" etc in your workbook and pull the info from these sheets?
    If so, are the sheets NOT named "Lab ?" the first sheets in your workbook? How many of these are there in your workbook?
    If not, how do you determine how many PDF files you're going to end up with?

    Maybe mock up a representative workbook without information that should not be out in the open and explain in detail what your needs are and in what order this needs to be done.

  13. #13
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    The data for the "indv rep" comes from another worksheet in the workbook. I've attached a mock-up of the workbook.
    (To cycle through the various labs -while you're on the Indv Rep tab- press CTRL+M for a message box prompt and select a number from 1 to 140.)
    Last edited by shawnpatrick; 10-10-2019 at 08:44 AM.

  14. #14
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    If you run this code, how far does that get you?
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    YES! A thousand times I thank you! Absolutely brilliant, thanks so much for your effort!
    Issue Resolved!

  16. #16
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Unique Print to PDF Challenge

    Thanks for letting us know and good luck.
    Will be leaving for your area in a couple weeks to get away from the winter weather.

  17. #17
    Registered User
    Join Date
    08-24-2017
    Location
    phoenix, az
    MS-Off Ver
    2010
    Posts
    9

    Re: Unique Print to PDF Challenge

    It's the perfect time of year to visit here ^_^

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Select a unique value from a list and print the workbook
    By judeprem in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-28-2016, 02:18 AM
  2. VBA. identify unique values, loop them, filter them in, set print area & print it
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-09-2012, 09:56 PM
  3. Excel to print unique reference numbers
    By Vibu212 in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 05-16-2011, 04:05 PM
  4. Print Challenge
    By rz6657 in forum Excel General
    Replies: 1
    Last Post: 09-21-2007, 07:37 AM
  5. how to print a page many times but add a unique reference on each
    By ms_540 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-06-2006, 02:45 PM
  6. Challenge: Unique Values via Formulas
    By Peter Bernadyne in forum Excel General
    Replies: 3
    Last Post: 03-27-2006, 01:18 PM
  7. Print unique values
    By omnibrown in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-12-2006, 08:45 PM

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