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