+ Reply to Thread
Results 1 to 6 of 6

Macro to pdf multiple worksheets from one workbook

  1. #1
    Registered User
    Join Date
    05-18-2012
    Location
    OC, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Macro to pdf multiple worksheets from one workbook

    With the help of this forum I have created a macro that will: 1) exctract multple worksheets from a workbook and save each one on a desktop folder (named "AP" with each excel file named as the worksheet name 2) I have also created another macro that will extract each worksheet from the workbook and save it as a PDF. I've combined both but have some issues.

    What I want to do is keep the extracted worksheets as new workbooks (#1 above) and
    1) save a pdf version of each workbook in the same folder.
    2) I want the PDF file to have the same name as the worksheet and add "delinquency report" to the end of all file names.
    3) I want the PDF file to save where the extracted worksheets are being saved - C:\Documents and Settings\Desktop\AP\.

    What is happening is the PDF is being saved to the My Documents folder with the name Book 1, Book 2, etc.

    Here is the code I have:
    Please Login or Register  to view this content.
    Last edited by ljuarez714; 02-27-2013 at 03:39 PM.

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

    Re: Macro to pdf multiple worksheets from one workbook

    If you change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Is that what you mean?

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to pdf multiple worksheets from one workbook

    Hi ljuarez714

    This is the Code I use to do as you describe
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

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

    Re: Macro to pdf multiple worksheets from one workbook

    Maybe you want to adapt the attached workbook.
    That'll give you some more choices.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-18-2012
    Location
    OC, California
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Macro to pdf multiple worksheets from one workbook

    Hi jeslake, I get a runtime error 1004. When I go to debug, the following section is highlighted.

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strfilepath & strPdfName, _
    Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
    OpenAfterPublish:=False

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to pdf multiple worksheets from one workbook

    Hi ljuarez714

    You'll get that error if this does not exist or is not entered properly...check it carefully
    Please Login or Register  to view this content.

+ 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