我正在使用代码来刷新Pivots并且它可以工作,但是我遇到了错误处理程序,它给了我:
未设置块变量的对象变量
这是我正在使用的代码:
Sub RefreshAllPivots()
On Error GoTo Errhandler
Dim pivotTable As pivotTable
For Each pivotTable In ActiveSheet.PivotTables
pivotTable.RefreshTable
Next
Errhandler:
MsgBox "Error Refreshing " & pivotTable.Name
MsgBox "All Pivots Refreshed"
End Sub
Run Code Online (Sandbox Code Playgroud)
非常感谢