I finally found the answer myself. Maybe I had posted too little code above, so nobody could help.
Anyway, here's the way you create Excel pivot table slicers from VBS:
Dim slCache, SL, wsPvt
Set wsPvt = wb.Worksheets("PIVOT")
Set slCache = wb.SlicerCaches.Add2(pvtTable, "Unit")
' Syntax: Slicers.Add(SlicerDestination, Level, Name, Caption, Top, Left, Width, Height)
Set SL = slCache.Slicers.Add(wsPvt, , "Unit", "Unit type")
SL.Top = 160
SL.Left = 490
SL.Width = 144
SL.Height = 188
SL.Style = "SlicerStyleDark1"
Bookmarks