+ Reply to Thread
Results 1 to 9 of 9

Efficient method to convert excel workbooks to PDF

  1. #1
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Efficient method to convert excel workbooks to PDF

    Hi everyone,

    I have a piece of code which loops through around 1000 entries and creates unique workbooks for each one. This code works great when saving each workbook in the loop as an xlsx file. I made a small adjustment so the files save as PDF with the following line:

    Please Login or Register  to view this content.
    I have also turned off ScreenUpdate.

    I estimate it would take around 5 hours to create all 1000 PDFs. Does anyone know of any faster method of saving this workbooks as PDF? Is it perhaps faster to create the excel workbooks first and then convert afterwards? If so, how could I do that using VBA?

    Any ideas?

    Thanks!!

  2. #2
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Efficient method to convert excel workbooks to PDF

    did you turn off calculation as well?

  3. #3
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Efficient method to convert excel workbooks to PDF

    Hi Loki, no I haven't. There are 3 sheets calculated for each item in the 1000 row loop. Would I turn off calculations just within the loop?

  4. #4
    Forum Contributor
    Join Date
    04-20-2015
    Location
    Switzerland
    MS-Off Ver
    2010
    Posts
    312

    Re: Efficient method to convert excel workbooks to PDF

    I would put it before you start exporting and reset it when finished like this

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Efficient method to convert excel workbooks to PDF

    Hi Loki,

    I'm think I might have the extra links in the wrong spot. Only the first row of the loop is being generated. Here's the code I have:

    Please Login or Register  to view this content.
    Can you give me a hand placing the calculation lines in the right spots?

    Thanks!
    Last edited by Groovicles; 08-31-2016 at 10:30 AM.

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,037

    Re: Efficient method to convert excel workbooks to PDF

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Never use Merged Cells in Excel

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,289

    Re: Efficient method to convert excel workbooks to PDF

    How about this?
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  8. #8
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    Re: Efficient method to convert excel workbooks to PDF

    Hi bakerman,

    Thanks very much for your variation of the code. I've tried it out and it seems the code doesn't automatically save the files to the SPath folder and they don't seem to save as PDF (rather as an excel file) or with the proper file name either.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,289

    Re: Efficient method to convert excel workbooks to PDF

    My bad. change this line

    Please Login or Register  to view this content.
    to this

    Please Login or Register  to view this content.
    As far as the filename goes I didn't change anything.
    Last edited by bakerman2; 08-31-2016 at 10:48 PM.

+ 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. [SOLVED] Most efficient method to highlight all visible rows below the first with Interior.Color?
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2015, 11:05 AM
  2. [SOLVED] efficient method to add a value to visible cells in an autofiltered worksheet
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2015, 07:45 PM
  3. How to convert some numbers in to the most efficient ratio
    By Shahid_Excel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-17-2014, 01:58 PM
  4. [SOLVED] More efficient (faster) sub-String method?
    By Bytor47 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-12-2013, 08:40 AM
  5. [SOLVED] Looking for more efficient method of dividing actual spends
    By anemptyroad in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-19-2013, 12:42 PM
  6. A More Efficient Method Than the Evaluate Method?
    By anthony.mcgovern in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-22-2011, 05:39 AM
  7. Can anyone help me convert to more efficient code?
    By slo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2006, 12:05 PM

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