Looping PivotTables

Jun 25, 2012 at 8:48 PM
Edited Jun 25, 2012 at 10:07 PM

I'm trying to loop through the pivottables collection like so:

For Each pt As PivotTable In wks.PivotTables

But it shows the error:

Error 19 Expression is of type 'LateBindingApi.Core.COMObject', which is not a collection type.

Is there something that I'm missing?

-------------------

Update, I found the answer. It was in the documentation.

Dim pts As PivotTables = wks.PivotTables            
       For Each pt As PivotTable In pts