Refresh all pivot tables in file
<p>When I run this code in Excel 2010 I get the error message:</p>
<blockquote>
<p>1004 refresh table method of pivot table class failed</p>
</blockquote>
<pre class="lang-vb prettyprint-override"><code>Sub AllWorkbookPivots()
    Dim pt As PivotTable
    Dim ws As Worksheet

    For Each ws In ActiveWorkbook.Worksheets
        For Each pt In ws.PivotTables
            pt.RefreshTable
        Next pt
    Next ws

End Sub
</code></pre>