+ Reply to Thread
Results 1 to 14 of 14

Convert Spreadsheet to PDF (Button/Macro)

  1. #1
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Convert Spreadsheet to PDF (Button/Macro)

    Hi,
    I have coded a button, so that when pressed it will generate a pdf of the combined print areas of the three pages on my spreadsheet. (I have made sure to set the print areas on each page). However, when pressing, it generates the pdf, but each print area does not stay on its own page (because the width is too big). I was just wondering what to add to the code to ensure each print area stays on its own page. Thanks.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Convert Spreadsheet to PDF (Button/Macro)

    .
    The suggestions at this resource have not been confirmed here. This is a reputable site though.
    See if something at this URL can assist you:

    https://stackoverflow.com/questions/...e-converting-u

  3. #3
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Re: Convert Spreadsheet to PDF (Button/Macro)

    Thanks!! Legend

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Convert Spreadsheet to PDF (Button/Macro)

    Let us know how it turns out.

  5. #5
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Re: Convert Spreadsheet to PDF (Button/Macro)

    I have had a look at all the different bits of code on there, the following is the only one that is working:

    Please Login or Register  to view this content.
    However, although it is shrinking the document into 1 page (width wise), it is making it tiny and barely filling up half of the page.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Convert Spreadsheet to PDF (Button/Macro)

    .
    I'm not certain you will be able to get three pages shrunk down to one for printing. At least I have never been able to.

    Changing the display to Landscape, reducing the margins and manipulating the PRINT AREA on the worksheet ... I've been able to get maybe 1 1/4 pages on one
    print page. That is, so the printed product is readable.

    Accidentally, I've managed to get more than that on one printed sheet but the print was so small, you couldn't read anything ..... not usable.

    Anyone else have a suggestion ?

  7. #7
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Re: Convert Spreadsheet to PDF (Button/Macro)

    It's strange, because the original code that i was using is supposed to save each print area onto a pdf. I have checked the print areas, and done a print preview and on that, just by default the entire print area fits the size that it should (i.e. width on one page). I'm just unsure as to why my code could not convert that to pdf

  8. #8
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Re: Convert Spreadsheet to PDF (Button/Macro)

    I have just checked, the code below works when the print area selected is reasonably small. It seems that as soon as I pick a larger vertical selection that it is trying to retain its proportions, and hence as it increases in size vertically, it reduces horizontally.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Re: Convert Spreadsheet to PDF (Button/Macro)

    Just did a quick check, the pdf that the above creates, is exactly the same dimensions as if you print preview the set print area and select fit to one page. upon pressing fit all columns to one page, the print preview creates the dimensions that i want. I just need to find a way to code the "Fit all columns on one page" into my macro

  10. #10
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Re: Convert Spreadsheet to PDF (Button/Macro)

    Fixed it, literally all i had to do was go back to the other code and change some of the page setup properties
    Please Login or Register  to view this content.

  11. #11
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Convert Spreadsheet to PDF (Button/Macro)

    .
    Great !

    I was getting confused ... at first I understood the problem was how much of the sheet you could get printed on one sheet in the PDF.

    Then you said it wasn't converting to PDF.

    Here is a small macro I use to convert the active sheet to a pdf. I adjusted the margins to zero, orientation was horizontal (landscape) and I selected print to one sheet.
    The print area was set from Col A to Col Z and down to row 100. It managed to get all of it on the page ... but barely readable. It's not so small a print that it can't be
    understood but certainly would make for tired eyes after awhile.

    Please Login or Register  to view this content.
    Let me see what your macro does. ......

  12. #12
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Convert Spreadsheet to PDF (Button/Macro)

    .
    Your's creates pretty much the same thing. I'm surprised it was able to get all 26 columns and 100 rows on one sheet in PORTRAIT mode.

  13. #13
    Registered User
    Join Date
    07-25-2017
    Location
    England
    MS-Off Ver
    2013
    Posts
    86

    Re: Convert Spreadsheet to PDF (Button/Macro)

    Thanks for your help
    I have another quick question:

    Using the code below, the macro will create a pdf containing the 3 sheets that i have defined in the array. The page setup part is working completely fine. I was just wondering if i could make it so that the "Summary" Page is put at the top of the pdf.
    Please Login or Register  to view this content.

  14. #14
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Convert Spreadsheet to PDF (Button/Macro)

    .
    Interesting question.

    After messing around with it, it appears the order in which the tabs appear from left to right, dictate the order they will appear in the PDF.

    Let me see if there is vba code that does the same.

+ 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. Macro to convert spreadsheet to new format that is non-file specific
    By twaccess in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-11-2015, 05:15 AM
  2. Macro and linked button not copying to new spreadsheet tab.
    By KHE in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2013, 02:41 PM
  3. Macro button to possibly copy certain criteria to a new spreadsheet
    By aaaaaaiden in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-15-2013, 02:22 PM
  4. Macro with button to Convert into PDF Document
    By DoubLeA in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2012, 06:26 PM
  5. Assigning macro to a button icon in spreadsheet
    By jessetrunk in forum Excel General
    Replies: 2
    Last Post: 10-21-2010, 08:00 AM
  6. Want a Macro button that slides the spreadsheet
    By caliskier in forum Excel General
    Replies: 2
    Last Post: 09-21-2007, 08:12 PM
  7. [SOLVED] Removing Macro/Deleting a Button in a Spreadsheet
    By pnoble in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-14-2006, 12:40 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