it should be working. could be a reference issue? thanks!
Public Function PrintBMRC()
'on error resume next
Dim wb As Workbook
Dim slc As Slicer
Dim slcCache As SlicerCache
Dim slcItem As SlicerItem
Dim categoryName As String
Dim fileName As String
Dim filePath As String
'Set the file path - edit as necessary
filePath = "C:Temp"
'Get the slicer cache
'Set wb = ActiveWorkbook
'Workbooks("2024-04 AMP Dashboard.xlsm")
'Debug.Print ActiveWorkbook.SlicerCaches(2).Slicers(1).Name
Set slcCache = ActiveWorkbook.SlicerCaches("Slicer_Complex1")
slcCache.ClearManualFilter <ERROR HERE>
'Loop through the slicer's items
For Each slcItem In slcCache.SlicerItems
'Get the category name
categoryName = slcItem.Name
'Set the file name
fileName = categoryName & " - Report " & ".pdf"
'Print the PDF
slcCache.SlicerItems(categoryName).Selected = True
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, fileName:=filePath & fileName, Quality:=xlQualityStandard
'Deselect the slicer item
slcCache.SlicerItems(categoryName).Selected = False
Next slcItem
End Function
I tried declaring all slicer variables as plain objects but same result. I also know that the SlicerCache captures the object because it shows up with .Name