+ Reply to Thread
Results 1 to 10 of 10

Convert Sheet to PDF

  1. #1
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Convert Sheet to PDF

    I have created several worksheets in my WB and would like to run a macro that converts a selected sheet to PDF for ease of emailing without keep emailing the entire WB and so that the reciever does not have access to all the functions and formulas.

    Is this possible?

    Thanks
    Chris

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Convert Sheet to PDF

    I posted the code I use at http://www.excelforum.com/excel-prog...adobe-pdf.html
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Convert Sheet to PDF

    Thank you for your quick response. Sorry about the next question but I'm new to this! Do I need to create a new module to copy this code into or where does it go?

    Thanks
    Chris

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Convert Sheet to PDF

    The macro just prints the selected sheets to PDF, which you could do about as easily manually. I use it because there is other code that fills in data on a cover sheet, and prints the cover sheet and each other sheet of a workbook in turn, looping though the workbook. If it's not clear, it does nothing WRT email.

    I keep the macro in my Personal.xls, but you can put it in a code module in the workbook or an add-in. To put it in a code module,

    Adding a Macro to a Code Module
    1. Copy the code from the post
    2. Press Alt+F11 to open the Visual Basic Editor (VBE)
    3. From the menu bar in the VBE window, do Insert > Module
    4. Paste the code in the window that opens
    5. Press Alt+Q to close the VBE and return to Excel

    Here's an example of how it's used:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Convert Sheet to PDF

    Thank you, have pasted the code into a new module, but now the next bit is beyond me as I don't know how to make the code run as it does not show up in my macros when I want to assign a button to it??
    Sorry!!

    Chris

  6. #6
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Convert Sheet to PDF

    OK I have created a button called PrintPDF which now calls the programme - but get the error message 'Argument not optional'

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Convert Sheet to PDF

    Add this to the same module that contains PrintPDF:

    Please Login or Register  to view this content.
    ... which is repeated for convenience below:
    Please Login or Register  to view this content.

    Before running it, you MUST set a reference. In the VBE, Tools > References, tick Acrobat Distiller.

  8. #8
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Convert Sheet to PDF

    Have not got Acrobat Distiller listed - only Acrobat Access or Adobe Acrobat 7 & 8

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Convert Sheet to PDF

    I believe Distiller is bundled with all versions of Acrobat (I have Acrobat 9 Standard and it's included, and believe it was in the prior versions before I upgraded). It might have something to do with how you installed Acrobat -- you might need to ask Adobe.

  10. #10
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Convert Sheet to PDF

    Will have a look back at Adobe, thank you for your help this far. Hopefully I can sort out Distiller and everything will be ok.

    Thank you
    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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