+ Reply to Thread
Results 1 to 4 of 4

Create a PDF from Worksheet

  1. #1
    Registered User
    Join Date
    04-09-2008
    Location
    Detroit, MI
    MS-Off Ver
    2007
    Posts
    25

    Create a PDF from Worksheet

    I'm using Excel 2003 and Adobe Acrobat 6.0.

    I have a worksheet that I would like print, and save, to PDF via VBA.

    I know it's possible, but I haven't been able to figure it out. I've searched this forum with no success. You have always been so helpful to me in the past, any help would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    I saved this a long time ago, but never used it. It is for PDF995, but it may help. Have a read and see if it helps.

    Did you try recording a macro?

    Jason

    I've searched the message board and found several questions, but not a good example of how to print automatically from Excel to a PDF file. After a couple of days of searching and tweaking, I've got what I think is a fairly good solution for automating your printing of worksheets to PDF files.

    This solution requires the use of PDF995. This is a free utility available at www.PDF995.com. This is a print driver that allows you to print to a PDF file. The file is compatible with Adobe and can be read with the Adobe reader like any other PDF. The free version does pop-up some advertising with each print, but the automation works with around the pop-ups. I believe the full license version is about $10 and doesn't produce the pop-ups.

    The challenge in automating a PDF process is that the PDF driver will prompt the user for a filename. This is ok if you are printing just one sheet, but if you need to automate the production of several PDFs, you need to be able to specify the name of the file in the code. The subroutine SheetToPDF presented below allows you to specify a single worksheet and the full filename for the PDF. I've included all the code and external declarations needed. The two subs at the bottom give examples of how to call SheetToPDF with the passed parameters.

    I hope you find this helpful.
    Regards,
    Steve

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186
    This might help:

    Please Login or Register  to view this content.
    Just replace "CutePDF Writer auf CPW2:" with the name you have for Adobe Acrobat.
    if you are not sure the correct name, just start the macro recorder and then go: File -> Print...
    In there select the Pdf program you use and click print.
    After the .pdf is generate, just check the right name in the Visual Basic Editor.

    Hope it helps.

  4. #4
    Registered User
    Join Date
    04-09-2008
    Location
    Detroit, MI
    MS-Off Ver
    2007
    Posts
    25
    Quote Originally Posted by jasoncw View Post
    I saved this a long time ago, but never used it. It is for PDF995, but it may help. Have a read and see if it helps.

    Did you try recording a macro?

    Jason
    That worked great! Thank you.

    For some reason though, when I tried it on another machine, it prints straight to the default printer instead of selecting PDF Maker, even after I granted access in the reference library.

+ 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