+ Reply to Thread
Results 1 to 5 of 5

VBA to loop through slicer option and export each to PDF

  1. #1
    Registered User
    Join Date
    11-23-2016
    Location
    London
    MS-Off Ver
    2016
    Posts
    1

    VBA to loop through slicer option and export each to PDF

    Hi

    I am trying to write a VBA that will take my sheet through each slicer option and print each country to an individual PDF. The first part seems to work (and go through each slicer option) but I am struggling to get it to save to PDF with the variable file name.

    Any help would be really useful. Thanks in advance.

    Here is the code I am using currently:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 11-23-2016 at 01:07 PM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,919

    Re: VBA to loop through slicer option and export each to PDF

    It looks like you have a misplaced quote in there:
    Please Login or Register  to view this content.
    Try this
    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    08-16-2019
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    5

    Re: VBA to loop through slicer option and export each to PDF

    I have tried different guides to make a "slicer loop to pdf export" file.. but fail before i even get started. Even with the most basic excel file possible im not able to use the macro.

    Attachment 637610

    Why does it stop on the step in the picture?

    The error message says: "Run-time error '1004': Application-defined or object-defines error

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,367

    Re: VBA to loop through slicer option and export each to PDF

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    08-16-2019
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    5

    Re: VBA to loop through slicer option and export each to PDF

    Sorry for that, thanks!

+ 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. Loop through an autofilter and export a PDF for each option
    By Paulcbanks in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2016, 04:26 PM
  2. Slicer Selection loop is very slow!
    By barowan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2016, 10:09 AM
  3. Ribbon is missing slicer option
    By stephme55 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-11-2016, 06:25 PM
  4. Replies: 0
    Last Post: 09-10-2015, 08:25 AM
  5. Code to loop through pvt slicer very slow
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2014, 02:08 PM
  6. 'select all' option in slicer
    By Paul-NYS in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-24-2012, 09:23 AM

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