ClearAllFilters - 不编译

时间:2016-03-17 18:08:49

标签: excel vba excel-vba

我仍然在切片器更新中遇到ClearAllFilters问题。获取运行时错误:-2147217900 - 对象'SlicerCache'的方法'ClearAllFilters'失败。

Public Sub Reset1()
Dim pt As PivotTable
Dim slice As Slicer

Application.ScreenUpdating = False

ActiveWorkbook.Model.Refresh

For Each pt In ActiveSheet.PivotTables
    pt.RefreshTable
    For Each slice In pt.Slicers
       slice.SlicerCache.ClearAllFilters
On Error GoTo 0
    Next slice
    pt.PivotCache.Refresh
Next pt
Application.ScreenUpdating = True
Error 0
Dim xlAns As Integer

xlAns = MsgBox("Sorry, Missing data, do you wish to continue?", vbYesNo, "Restart process!")
Select Case xlAns
    Case vbYes
        MergeMultipleSheets
    Case Else
        Exit Sub
End Select

End Sub

0 个答案:

没有答案