I keep getting the Application-defined or object-defined error when running the code below, the error happens on the highlighted/bolded line.
I do not know enough to understand what I am doing wrong. Can someone please help me walk through how to fix it
I do not know enough to understand what I am doing wrong. Can someone please help me walk through how to fix it
VBA Code:
Sub CreateFoldersFromSlicer()
Dim slicer As slicer
Dim slicerCache As slicerCache
Dim slicerItem As slicerItem
Set slicerCache = ActiveWorkbook.SlicerCaches("Slicer_OutSalesPersonName3")
[B][/B]
[U][B]For Each slicerItem In slicerCache.SlicerItem[/B]s[/U]
If slicerItem.Selected = True Then
Dim fso As New FileSystemObject
fso.CreateFolder "my path" & slicerItem.Name
End If
Next slicerItem
End Sub