+ Reply to Thread
Results 1 to 2 of 2

Create pdf for every slicer item...vba error

  1. #1
    Registered User
    Join Date
    08-09-2011
    Location
    Utrecht
    MS-Off Ver
    Excel 2013
    Posts
    43

    Create pdf for every slicer item...vba error

    Hi,

    I want to create a vba code that loops through all of the slicer items one by one and creates a pdf of every item of the slicer. You can see my code over here but when I run it excel gives me an error message on the row: "Call saveaspdf(1)...The error message is: "compile error...Wrong number of arguments or invalid property assignment...

    PHP Code: 
    Sub Step_Thru_SlicerItems() 
        
    Dim slItem As SlicerItem 
        Dim i 
    As Long 
         
        Application
    .ScreenUpdating False 
        With ActiveWorkbook
    .SlicerCaches("Slicer_Store"
            .
    SlicerItems(1).Selected True 
            
    For Each slItem In .VisibleSlicerItems 
                
    If slItem.Name <> .SlicerItems(1).Name Then _ 
                    slItem
    .Selected False 
            Next slItem 
            Call saveaspdf
    (1
            For 
    2 To .SlicerItems.Count 
                
    .SlicerItems(i).Selected True 
                
    .SlicerItems(1).Selected False 
                Call saveaspdf
    (i
            
    Next i 
        End With 
        Application
    .ScreenUpdating True 
    End Sub 

    Sub saveaspdf
    () 

    Dim rngRange        As Range 

    Set rngRange 
    Worksheets("Pivot Graphs").Range("B2"

    Sheets("Pivot graphs").Activate 
    ActiveSheet
    .ExportAsFixedFormat Type:=xlTypePDFFilename:= 
        
    "\\vmware-host\Shared Folders\Desktop\Sales booster dashboard\Dashboard per winkel\" & rngRange & ".pdf" _ 
        , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ 
        :=False, OpenAfterPublish:=False 

    End Sub 

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,459

    Re: Create pdf for every slicer item...vba error

    I only show a compile error on your Calls.
    Change
    Call saveaspdf(i) and Call saveaspdf(1)
    to
    saveaspdf

+ 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] Create pdf print of every slicer item
    By jeroenft in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-25-2015, 08:13 AM
  2. Slicer Error VBA~~
    By meus in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-16-2015, 12:53 PM
  3. Workbook_Open to select first item in slicer/pivot
    By kev_33 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2015, 01:08 AM
  4. VBA code to create input box that will select one value in a slicer
    By Ind711 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2015, 04:19 PM
  5. Selecting a Slicer Item in VBA
    By ManUBlueJay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2014, 08:21 AM
  6. How to auto select from a Slicer last or top item
    By xtrenge in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-07-2014, 06:22 PM
  7. [SOLVED] Change Chart Title Depending on a Slicer - slicer advice
    By JungleJme in forum Excel General
    Replies: 8
    Last Post: 08-17-2012, 07:59 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