+ Reply to Thread
Results 1 to 6 of 6

VBA to Save Workbook as pdf

  1. #1
    Registered User
    Join Date
    03-02-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    14

    VBA to Save Workbook as pdf

    I want to put a button on my sheet that will save the entire workbook as a pdf. I want it to save in the same directory in which the excel file is located and I want it to save with the same file name as the excel file. I am sure this is possible and I wouldn't imagine it would be very difficult but I am have a difficult time with it. Any help would be appreciated.

    Thanks!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: VBA to Save Workbook as pdf

    Hi Jerums,

    I'd suggest recording a macro of you saving the workbook as a pdf, and then checking the code it creates. You'll be able to use most of it as recorded, but tweak a few bits relating to the directory path and workbook name.

    Let us know how that goes...

  3. #3
    Registered User
    Join Date
    08-29-2011
    Location
    Boise, ID
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA to Save Workbook as pdf

    Try one of these depending on your needs:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    03-02-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA to Save Workbook as pdf

    Thanks guys. I am almost there I think. What I have works, it just saves the pdf with a .xls in the file name. ie. My file name is Test results. My code will create a pdf titled "Test Results.xls.pdf". This will open properly and I have no problems with it, but it would be nice if there was a way to drop the ".xls" on the pdf file. Take a look at my code below and let me know if you have any ideas.

    Please Login or Register  to view this content.

    Thanks,
    Jeremy

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: VBA to Save Workbook as pdf

    Jeremy, try:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-02-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: VBA to Save Workbook as pdf

    Perfect!

    Thanks Paul.

+ 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