+ Reply to Thread
Results 1 to 14 of 14

Macro to export every worksheet to a separate PDF on a Mac

  1. #1
    Registered User
    Join Date
    03-11-2019
    Location
    Chicago, USA
    MS-Off Ver
    365
    Posts
    29

    Macro to export every worksheet to a separate PDF on a Mac

    For a couple of years, I've been using a macro in Excel on Windows 10 (running in Parallels on my Mac) that will export each worksheet in my workbook to a separate PDF, saving all of them in a Desktop Folder on my Mac called "ExcelPDFReports" . . . here's the code that works perfectly:

    Please Login or Register  to view this content.
    I would really like to get this to work directly on my Mac. When I try, I get an Error In Printing, with all four lines of code highlighted. Any suggestions on how to get this to work on a Mac?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,087

    Re: Macro to export every worksheet to a separate PDF on a Mac

    Can't you just record a macro on your Mac for one of the sheets. That will give you the basic code (for the Mac) and, from that, you should be able to see what you need to change.

    It's actually one line of code split over four lines. The underscore character is used to split the line to make it easier to read.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    03-11-2019
    Location
    Chicago, USA
    MS-Off Ver
    365
    Posts
    29

    Re: Macro to export every worksheet to a separate PDF on a Mac

    Thanks for the quick reply. I've actually tried that. To generate a PDF on the Mac side of Excel, there is no "Export to PDF" command . . . you have to choose to print the worksheet, then select Save To PDF from a dropdown menu. Going throug the process while "recording", nothing appears in the recorded macro.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,087

    Re: Macro to export every worksheet to a separate PDF on a Mac

    Ok, have a look at this link: https://www.rondebruin.nl/mac/mac005.htm

  5. #5
    Registered User
    Join Date
    03-11-2019
    Location
    Chicago, USA
    MS-Off Ver
    365
    Posts
    29

    Re: Macro to export every worksheet to a separate PDF on a Mac

    Thanks . . . that site looks very promising. From the four examples he highlights, the one that is relevant to me is:

    Please Login or Register  to view this content.
    When trying to run the macro, I get stopped at:

    Folderstring = CreateFolderinMacOffice2016(NameFolder:=FolderName)

    I'm running Office 365, which probably is going to affect where these PDF's get saved, etc. Any ideas on how to sort this out?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,087

    Re: Macro to export every worksheet to a separate PDF on a Mac

    You say you get stopped ... in what way? Did you copy the code for that function? Or does it fail in some way?

    I've asked for help as I’m way out of my depth now.

  7. #7
    Registered User
    Join Date
    03-11-2019
    Location
    Chicago, USA
    MS-Off Ver
    365
    Posts
    29

    Re: Macro to export every worksheet to a separate PDF on a Mac

    The macro just stopped with an error note.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,087

    Re: Macro to export every worksheet to a separate PDF on a Mac

    What line of code and what error note?

  9. #9
    Registered User
    Join Date
    03-11-2019
    Location
    Chicago, USA
    MS-Off Ver
    365
    Posts
    29

    Re: Macro to export every worksheet to a separate PDF on a Mac

    The dialog box says:

    Compile Error
    Sub or Function Not Defined

    And the highlighted code is: CreateFolderinMacOffice2016

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,087

    Re: Macro to export every worksheet to a separate PDF on a Mac

    I'm guessing you didn't copy this part of the code from Ron de Bruin's page:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-11-2019
    Location
    Chicago, USA
    MS-Off Ver
    365
    Posts
    29

    Re: Macro to export every worksheet to a separate PDF on a Mac

    Thanks again for your quick reply. OK . . . I'm very new to using Macros . . . is the code above to be copied and pasted within the larger code? I'm not sure what I should do at this point.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,087

    Re: Macro to export every worksheet to a separate PDF on a Mac

    Yes, copy it into the same module as the rest of the code (although it's not that important.)

  13. #13
    Registered User
    Join Date
    03-11-2019
    Location
    Chicago, USA
    MS-Off Ver
    365
    Posts
    29

    Re: Macro to export every worksheet to a separate PDF on a Mac

    It worked . . . perfectly!!!! Thank you so much for sticking with me until I got the solution. I really appreciate it.

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,087

    Re: Macro to export every worksheet to a separate PDF on a Mac

    You're welcome.


    Glad we were able to get you a solution



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Macro to Export data into another worksheet
    By Khafez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2016, 04:08 PM
  2. Edit Macro to export filtered data into separate worksheet instead of PDF
    By tkowon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2014, 11:23 AM
  3. Simple Macro to Export Each Cell as Separate Files
    By Moop in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-16-2013, 12:55 PM
  4. Macro - Export worksheet to new workbook and unprotect
    By adamheon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2013, 09:03 AM
  5. [SOLVED] How to use a Macro submit button to export results to another worksheet
    By EscargotMyCargo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-21-2013, 07:51 AM
  6. [SOLVED] Macro to export a worksheet and save as new file
    By Mike_M in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-25-2005, 05:50 AM
  7. [SOLVED] Simple macro needed to export a worksheet
    By RobG in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-12-2005, 05:12 AM

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