我正在使用代码刷新数据透视表,并且它已经起作用了,但是我在错误处理程序中遇到了困难,它给了我以下错误信息:
对象变量与块变量未设置
这是我正在使用的代码:
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
非常感谢